IndentedTextWriter Constructor (TextWriter, String)


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

Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string.

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

public IndentedTextWriter(
	TextWriter writer,
	string tabString


Type: System.IO.TextWriter

The TextWriter to use for output.

Type: System.String

The tab string to use for indentation.

The following code example demonstrates creating an IndentedTextWriter using a specified tab string.

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


for full trust for the immediate caller. This member cannot be used by partially trusted code.

.NET Framework
Available since 1.1
Return to top