Class IndentedTextWriter
Namespace: ValveResourceFormat
Assembly: ValveResourceFormat.dll
The same as but works in partial trust. Taken from System.Data.Entity.Migrations.Utilities.IndentedTextWriter.
public class IndentedTextWriter : TextWriter, IAsyncDisposable, IDisposableInheritance
object ← MarshalByRefObject ← TextWriter ← IndentedTextWriter
Implements
Inherited Members
TextWriter.CoreNewLine, TextWriter.Null, TextWriter.Close(), TextWriter.CreateBroadcasting(params TextWriter[]), TextWriter.Dispose(), TextWriter.Dispose(bool), TextWriter.DisposeAsync(), TextWriter.Flush(), TextWriter.FlushAsync(), TextWriter.FlushAsync(CancellationToken), TextWriter.Synchronized(TextWriter), TextWriter.Write(bool), TextWriter.Write(char), TextWriter.Write(char[]?), TextWriter.Write(char[], int, int), TextWriter.Write(decimal), TextWriter.Write(double), TextWriter.Write(int), TextWriter.Write(long), TextWriter.Write(object?), TextWriter.Write(ReadOnlySpan<char>), TextWriter.Write(float), TextWriter.Write(string?), TextWriter.Write(string, object?), TextWriter.Write(string, object?, object?), TextWriter.Write(string, object?, object?, object?), TextWriter.Write(string, params object?[]), TextWriter.Write(string, params ReadOnlySpan<object?>), TextWriter.Write(StringBuilder?), TextWriter.Write(uint), TextWriter.Write(ulong), TextWriter.WriteAsync(char), TextWriter.WriteAsync(char[]?), TextWriter.WriteAsync(char[], int, int), TextWriter.WriteAsync(ReadOnlyMemory<char>, CancellationToken), TextWriter.WriteAsync(string?), TextWriter.WriteAsync(StringBuilder?, CancellationToken), TextWriter.WriteLine(), TextWriter.WriteLine(bool), TextWriter.WriteLine(char), TextWriter.WriteLine(char[]?), TextWriter.WriteLine(char[], int, int), TextWriter.WriteLine(decimal), TextWriter.WriteLine(double), TextWriter.WriteLine(int), TextWriter.WriteLine(long), TextWriter.WriteLine(object?), TextWriter.WriteLine(ReadOnlySpan<char>), TextWriter.WriteLine(float), TextWriter.WriteLine(string?), TextWriter.WriteLine(string, object?), TextWriter.WriteLine(string, object?, object?), TextWriter.WriteLine(string, object?, object?, object?), TextWriter.WriteLine(string, params object?[]), TextWriter.WriteLine(string, params ReadOnlySpan<object?>), TextWriter.WriteLine(StringBuilder?), TextWriter.WriteLine(uint), TextWriter.WriteLine(ulong), TextWriter.WriteLineAsync(), TextWriter.WriteLineAsync(char), TextWriter.WriteLineAsync(char[]?), TextWriter.WriteLineAsync(char[], int, int), TextWriter.WriteLineAsync(ReadOnlyMemory<char>, CancellationToken), TextWriter.WriteLineAsync(string?), TextWriter.WriteLineAsync(StringBuilder?, CancellationToken), TextWriter.Encoding, TextWriter.FormatProvider, TextWriter.NewLine, MarshalByRefObject.GetLifetimeService(), MarshalByRefObject.InitializeLifetimeService(), MarshalByRefObject.MemberwiseClone(bool)
Constructors
IndentedTextWriter()
Initializes a new instance of the class.
public IndentedTextWriter()IndentedTextWriter(StringWriter)
Initializes a new instance of the class.
public IndentedTextWriter(StringWriter writer)Parameters
writer StringWriter
Fields
TabString
Specifies the default tab string. This field is constant.
public const string TabString = "\t"Field Value
Properties
Encoding
When overridden in a derived class, returns the character encoding in which the output is written.
public override Encoding Encoding { get; }Property Value
Indent
Gets or sets the number of spaces to indent.
public int Indent { get; set; }Property Value
NewLine
Gets or sets the line terminator string used by the current TextWriter.
[AllowNull]
public override string NewLine { get; set; }Property Value
Methods
Close()
Closes the current writer and releases any system resources associated with the writer.
public override void Close()Dispose(bool)
Releases the unmanaged resources used by the and optionally releases the managed resources.
protected override void Dispose(bool disposing)Parameters
disposing bool
true to release both managed and unmanaged resources; false to release only unmanaged resources.
EnsureCapacity(int)
Ensures that the capacity of this writer is at least the specified value.
public int EnsureCapacity(int capacity)Parameters
capacity int
The new capacity for this writer.
Returns
Flush()
Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
public override void Flush()Grow(int)
Grows this writer to match the specified min capacity.
public int Grow(int minCapacity)Parameters
minCapacity int
The minimum capacity for this writer.
Returns
OutputTabs()
Outputs the tab string once for each level of indentation according to the property.
protected virtual void OutputTabs()ToString()
Returns a string that represents the current object.
public override string ToString()Returns
A string that represents the current object.
Write(string?)
Writes a string to the text stream.
public override void Write(string? value)Parameters
value string?
The string to write.
Exceptions
The is closed.
An I/O error occurs.
Write(bool)
Writes the text representation of a Boolean value to the text stream.
public override void Write(bool value)Parameters
value bool
The Boolean value to write.
Exceptions
The is closed.
An I/O error occurs.
Write(char)
Writes a character to the text stream.
public override void Write(char value)Parameters
value char
The character to write to the text stream.
Exceptions
The is closed.
An I/O error occurs.
Write(char[]?)
Writes a character array to the text stream.
public override void Write(char[]? buffer)Parameters
buffer char[]?
The character array to write to the text stream.
Exceptions
The is closed.
An I/O error occurs.
Write(char[], int, int)
Writes a subarray of characters to the text stream.
public override void Write(char[] buffer, int index, int count)Parameters
buffer char[]
The character array to write data from.
index int
The character position in the buffer at which to start retrieving data.
count int
The number of characters to write.
Exceptions
The buffer length minus index is less than count.
The buffer parameter is null.
index or count is negative.
The is closed.
An I/O error occurs.
Write(decimal)
Writes the text representation of a decimal value to the text stream.
public override void Write(decimal value)Parameters
value decimal
The decimal value to write.
Exceptions
The is closed.
An I/O error occurs.
Write(double)
Writes the text representation of an 8-byte floating-point value to the text stream.
public override void Write(double value)Parameters
value double
The 8-byte floating-point value to write.
Exceptions
The is closed.
An I/O error occurs.
Write(float)
Writes the text representation of a 4-byte floating-point value to the text stream.
public override void Write(float value)Parameters
value float
The 4-byte floating-point value to write.
Exceptions
The is closed.
An I/O error occurs.
Write(int)
Writes the text representation of a 4-byte signed integer to the text stream.
public override void Write(int value)Parameters
value int
The 4-byte signed integer to write.
Exceptions
The is closed.
An I/O error occurs.
Write(long)
Writes the text representation of an 8-byte signed integer to the text stream.
public override void Write(long value)Parameters
value long
The 8-byte signed integer to write.
Exceptions
The is closed.
An I/O error occurs.
Write(object?)
Writes the text representation of an object to the text stream by calling the ToString method on that object.
[Obsolete("Do not write to string as a generic object, this is probably a mistake.")]
public override void Write(object? value)Parameters
value object?
The object to write.
Exceptions
The is closed.
An I/O error occurs.
Write(string, object?)
Writes a formatted string to the text stream, using the same semantics as the method.
public override void Write(string format, object? arg0)Parameters
format string
A composite format string.
arg0 object?
The object to format and write.
Exceptions
format is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is one).
Write(string, object?, object?)
Writes a formatted string to the text stream using the same semantics as the method.
public override void Write(string format, object? arg0, object? arg1)Parameters
format string
A composite format string.
arg0 object?
The first object to format and write.
arg1 object?
The second object to format and write.
Exceptions
format is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero) or greater than or equal to the number of objects to be formatted (which, for this method overload, is two).
Write(string, params object?[])
Writes a formatted string to the text stream, using the same semantics as the method.
public override void Write(string format, params object?[] arg)Parameters
format string
A composite format string.
arg object?[]
An object array that contains zero or more objects to format and write.
Exceptions
format or arg is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the arg array.
WriteLine(string?)
Writes a string to the text stream, followed by a line terminator.
public override void WriteLine(string? value)Parameters
value string?
The string to write. If value is null, only the line terminator is written.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(ReadOnlySpan<char>)
Writes the text representation of a character span to the text stream, followed by a line terminator.
public override void WriteLine(ReadOnlySpan<char> buffer)Parameters
buffer ReadOnlySpan<char>
The char span value to write to the text stream.
WriteLine()
Writes a line terminator to the text stream.
public override void WriteLine()Exceptions
The is closed.
An I/O error occurs.
WriteLine(bool)
Writes the text representation of a Boolean value to the text stream, followed by a line terminator.
public override void WriteLine(bool value)Parameters
value bool
The Boolean value to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(char)
Writes a character to the text stream, followed by a line terminator.
public override void WriteLine(char value)Parameters
value char
The character to write to the text stream.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(char[]?)
Writes an array of characters to the text stream, followed by a line terminator.
public override void WriteLine(char[]? buffer)Parameters
buffer char[]?
The character array from which data is read.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(char[], int, int)
Writes a subarray of characters to the text stream, followed by a line terminator.
public override void WriteLine(char[] buffer, int index, int count)Parameters
buffer char[]
The character array from which data is read.
index int
The character position in buffer at which to start reading data.
count int
The maximum number of characters to write.
Exceptions
The buffer length minus index is less than count.
The buffer parameter is null.
index or count is negative.
The is closed.
An I/O error occurs.
WriteLine(double)
Writes the text representation of a 8-byte floating-point value to the text stream, followed by a line terminator.
public override void WriteLine(double value)Parameters
value double
The 8-byte floating-point value to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(float)
Writes the text representation of a 4-byte floating-point value to the text stream, followed by a line terminator.
public override void WriteLine(float value)Parameters
value float
The 4-byte floating-point value to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(int)
Writes the text representation of a 4-byte signed integer to the text stream, followed by a line terminator.
public override void WriteLine(int value)Parameters
value int
The 4-byte signed integer to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(long)
Writes the text representation of an 8-byte signed integer to the text stream, followed by a line terminator.
public override void WriteLine(long value)Parameters
value long
The 8-byte signed integer to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(object?)
Writes the text representation of an object to the text stream, by calling the ToString method on that object, followed by a line terminator.
public override void WriteLine(object? value)Parameters
value object?
The object to write. If value is null, only the line terminator is written.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(uint)
Writes the text representation of a 4-byte unsigned integer to the text stream, followed by a line terminator.
public override void WriteLine(uint value)Parameters
value uint
The 4-byte unsigned integer to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(ulong)
Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.
public override void WriteLine(ulong value)Parameters
value ulong
The 8-byte unsigned integer to write.
Exceptions
The is closed.
An I/O error occurs.
WriteLine(string, object?)
Writes a formatted string and a new line to the text stream, using the same semantics as the method.
public override void WriteLine(string format, object? arg0)Parameters
format string
A composite format string.
arg0 object?
The object to format and write.
Exceptions
format is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is one).
WriteLine(string, object?, object?)
Writes a formatted string and a new line to the text stream, using the same semantics as the method.
public override void WriteLine(string format, object? arg0, object? arg1)Parameters
format string
A composite format string.
arg0 object?
The first object to format and write.
arg1 object?
The second object to format and write.
Exceptions
format is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is two).
WriteLine(string, object?, object?, object?)
Writes out a formatted string and a new line to the text stream, using the same semantics as .
public override void WriteLine(string format, object? arg0, object? arg1, object? arg2)Parameters
format string
A composite format string.
arg0 object?
The first object to format and write.
arg1 object?
The second object to format and write.
arg2 object?
The third object to format and write.
Exceptions
format is null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is three).
WriteLine(string, params object?[])
Writes out a formatted string and a new line to the text stream, using the same semantics as .
public override void WriteLine(string format, params object?[] arg)Parameters
format string
A composite format string.
arg object?[]
An object array that contains zero or more objects to format and write.
Exceptions
A string or object is passed in as null.
The is closed.
An I/O error occurs.
format is not a valid composite format string.
-or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the arg array.
WriteLine(string, params ReadOnlySpan<object?>)
Writes out a formatted string and a new line to the text stream, using the same semantics as .
public override void WriteLine(string format, params ReadOnlySpan<object?> arg)Parameters
format string
A composite format string.
arg ReadOnlySpan<object?>
An object span that contains zero or more objects to format and write.

