Share via


IndentedTextWriter Class

Definition

The same as IndentedTextWriter but works in partial trust and adds explicit caching of generated indentation string and also recognizes writing a string that contains just \r\n or \n as a write-line to ensure we indent the next line properly.

public class IndentedTextWriter : System.IO.TextWriter
type IndentedTextWriter = class
    inherit TextWriter
Public Class IndentedTextWriter
Inherits TextWriter
Inheritance
IndentedTextWriter

Constructors

IndentedTextWriter(TextWriter, String)

Initializes a new instance of the IndentedTextWriter class using the specified text writer and tab string. Note that the writer passed to this constructor must use the CultureInfo specified by the Culture property.

IndentedTextWriter(TextWriter)

Initializes a new instance of the IndentedTextWriter class using the specified text writer and default tab string. Note that the writer passed to this constructor must use the CultureInfo specified by the Culture property.

Fields

Culture

Specifies the culture what will be used by the underlying TextWriter. This static property is read-only. Note that any writer passed to one of the constructors of IndentedTextWriter must use this same culture. The culture is InvariantCulture.

DefaultTabString

Specifies the default tab string. This field is constant.

Properties

Encoding

Gets the encoding for the text writer to use.

Indent

Gets or sets the number of spaces to indent.

InnerWriter

Gets the TextWriter to use.

NewLine

Gets or sets the new line character to use.

Methods

Close()

Closes the document being written to.

CurrentIndentation()

Builds a string representing the current indentation level for a new line.

Flush()

Flushes the stream.

OutputTabs()

Outputs the tab string once for each level of indentation according to the Indent property.

Write(Boolean)

Writes the text representation of a Boolean value to the text stream.

Write(Char)

Writes a character to the text stream.

Write(Char[], Int32, Int32)

Writes a subarray of characters to the text stream.

Write(Char[])

Writes a character array to the text stream.

Write(Double)

Writes the text representation of a Double to the text stream.

Write(Int32)

Writes the text representation of an integer to the text stream.

Write(Int64)

Writes the text representation of an 8-byte integer to the text stream.

Write(Object)

Writes the text representation of an object to the text stream.

Write(Single)

Writes the text representation of a Single to the text stream.

Write(String, Object, Object)

Writes out a formatted string, using the same semantics as specified.

Write(String, Object)

Writes out a formatted string, using the same semantics as specified.

Write(String, Object[])

Writes out a formatted string, using the same semantics as specified.

Write(String)

Writes the specified string to the text stream.

WriteLine()

Writes a line terminator.

WriteLine(Boolean)

Writes the text representation of a Boolean, followed by a line terminator, to the text stream.

WriteLine(Char)

Writes a character, followed by a line terminator, to the text stream.

WriteLine(Char[], Int32, Int32)

Writes a subarray of characters, followed by a line terminator, to the text stream.

WriteLine(Char[])

Writes a character array, followed by a line terminator, to the text stream.

WriteLine(Double)

Writes the text representation of a Double, followed by a line terminator, to the text stream.

WriteLine(Int32)

Writes the text representation of an integer, followed by a line terminator, to the text stream.

WriteLine(Int64)

Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream.

WriteLine(Object)

Writes the text representation of an object, followed by a line terminator, to the text stream.

WriteLine(Single)

Writes the text representation of a Single, followed by a line terminator, to the text stream.

WriteLine(String, Object, Object)

Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(String, Object)

Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(String, Object[])

Writes out a formatted string, followed by a line terminator, using the same semantics as specified.

WriteLine(String)

Writes the specified string, followed by a line terminator, to the text stream.

WriteLine(UInt32)

Writes the text representation of a UInt32, followed by a line terminator, to the text stream.

WriteLineNoTabs(String)

Writes the specified string to a line without tabs.

Applies to