IndentedTextWriter.Indent Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the number of spaces to indent.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

public int Indent { get; set; }

Property Value

Type: System.Int32

The number of spaces to indent.

The following code example demonstrates setting the indentation level of an IndentedTextWriter. The indentation level is the number of tab strings to prefix each line with.

// 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, "    ");           

.NET Framework
Available since 1.1
Return to top
Show: