IndentedTextWriter.Indent 属性

定义

获取或设置缩进的空格数。

public:
 property int Indent { int get(); void set(int value); };
public int Indent { get; set; }
member this.Indent : int with get, set
Public Property Indent As Integer

属性值

要缩进的空格数。

示例

下面的代码示例演示如何设置 的缩进级别 IndentedTextWriter。 缩进级别是每行前缀的制表符字符串数。

// Creates a TextWriter to use as the base output writer.
System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter;

// Create an IndentedTextWriter and set the tab string to use 
// as the indentation string for each indentation level.
System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter,"    " );
// Creates a TextWriter to use as the base output writer.
System.IO.StringWriter baseTextWriter = new System.IO.StringWriter();

// Create an IndentedTextWriter and set the tab string to use
// as the indentation string for each indentation level.
System.CodeDom.Compiler.IndentedTextWriter indentWriter = new IndentedTextWriter(baseTextWriter, "    ");
  ' Create a TextWriter to use as the base output writer.
  Dim baseTextWriter As New System.IO.StringWriter

  ' Create an IndentedTextWriter and set the tab string to use 
  ' as the indentation string for each indentation level.
  Dim indentWriter = New IndentedTextWriter(baseTextWriter, "    ")

适用于