Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​CodeDom.​Compiler.​IndentedTextWriter
Assembly: System.Runtime
Inheritance: object → MarshalByRefObject → IO.​TextWriter → IndentedTextWriter
Implemented Interfaces
- IAsyncDisposable Implemented by: TextWriter
- IDisposable Implemented by: TextWriter
Provides a text writer that can indent new lines by a tab string token.
Fields and Constants
public const
string
DefaultTabString
Specifies the default tab string. This field is constant.
protected
char[]
CoreNewLine
Stores the newline characters used for this <see langword="TextWriter" /> .
Properties
Encoding
Gets the encoding for the text writer to use.
public
int
Indent
Gets or sets the number of spaces to indent.
InnerWriter
Gets the <see cref="T:System.IO.TextWriter" /> to use.
public
string
NewLine
Gets or sets the new line character to use.
public
IFormatProvider
FormatProvider
Gets an object that controls formatting.
Methods
public
void
Close​()
Closes the document being written to.
DisposeAsync​()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Returns A <see cref="T:System.Threading.Tasks.ValueTask" /> representing the asynchronous dispose operation.
public
void
Flush​()
Flushes the stream.
FlushAsync​()
Clears all buffers for this <see cref="T:System.CodeDom.Compiler.IndentedTextWriter" /> asynchronously and causes any buffered data to be written to the underlying device.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous flush operation.
FlushAsync​(Threading.​CancellationToken cancellationToken)
Clears all buffers for this <see cref="T:System.CodeDom.Compiler.IndentedTextWriter" /> asynchronously and causes any buffered data to be written to the underlying device.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous flush operation.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> to monitor for cancellation requests.
protected
void
OutputTabs​()
Outputs the tab string once for each level of indentation according to the <see cref="P:System.CodeDom.Compiler.IndentedTextWriter.Indent" /> property.
OutputTabsAsync​()
Asynchronously outputs tabs to the underlying <see cref="T:System.IO.TextWriter" /> based on the current <see cref="P:System.CodeDom.Compiler.IndentedTextWriter.Indent" /> .
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
public
void
Write​(bool value)
Writes the text representation of a Boolean value to the text stream.
value
The Boolean value to write.
public
void
Write​(char value)
Writes a character to the text stream.
value
The character to write.
public
void
Write​(char[] buffer)
Writes a character array to the text stream.
buffer
The character array to write.
public
void
Write​(char[] buffer,
int index,
int count)
Writes a subarray of characters to the text stream.
buffer
The character array to write data from.
index
Starting index in the buffer.
count
The number of characters to write.
public
void
Write​(double value)
Writes the text representation of a Double to the text stream.
value
The <see langword="double" /> to write.
public
void
Write​(int value)
Writes the text representation of an integer to the text stream.
value
The integer to write.
public
void
Write​(long value)
Writes the text representation of an 8-byte integer to the text stream.
value
The 8-byte integer to write.
public
void
Write​(object value)
Writes the text representation of an object to the text stream.
value
The object to write.
public
void
Write​(Single value)
Writes the text representation of a Single to the text stream.
value
The <see langword="single" /> to write.
public
void
Write​(string s)
Writes the specified string to the text stream.
s
The string to write.
public
void
Write​(string format,
object arg0)
Writes out a formatted string, using the same semantics as specified.
format
The formatting string.
arg0
The object to write into the formatted string.
public
void
Write​(string format,
object arg0,
object arg1)
Writes out a formatted string, using the same semantics as specified.
format
The formatting string to use.
arg0
The first object to write into the formatted string.
arg1
The second object to write into the formatted string.
public
void
Write​(string format,
object[] arg)
Writes out a formatted string, using the same semantics as specified.
format
The formatting string to use.
arg
The argument array to output.
public
void
Write​(string format,
ReadOnlySpan<​object> arg)
Writes out a formatted string, using the same semantics as specified.
format
The formatting string to use.
arg
The argument span to output.
WriteAsync​(char value)
Asynchronously writes the specified <see cref="T:System.Char" /> to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The <see cref="T:System.Char" /> to write.
WriteAsync​(char[] buffer,
int index,
int count)
Asynchronously writes the specified number of <see cref="T:System.Char" /> s from the specified buffer to the underlying <see cref="T:System.IO.TextWriter" /> , starting at the specified index, and outputting tabs at the start of every new line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
buffer
The array to write from.
index
Index in the array to stort writing at.
count
The number of characters to write.
WriteAsync​(ReadOnlyMemory<​char> buffer,
Threading.​CancellationToken cancellationToken = null)
Asynchronously writes the specified characters to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
buffer
The characters to write.
cancellationToken
Token for canceling the operation.
WriteAsync​(string value)
Asynchronously writes the specified string to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The string to write.
WriteAsync​(Text.​StringBuilder? value,
Threading.​CancellationToken cancellationToken = null)
Asynchronously writes the contents of the specified <see cref="T:System.Text.StringBuilder" /> to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The text to write.
cancellationToken
Token for canceling the operation.
public
void
WriteLine​()
Writes a line terminator.
public
void
WriteLine​(bool value)
Writes the text representation of a Boolean, followed by a line terminator, to the text stream.
value
The Boolean to write.
public
void
WriteLine​(char value)
Writes a character, followed by a line terminator, to the text stream.
value
The character to write.
public
void
WriteLine​(char[] buffer)
Writes a character array, followed by a line terminator, to the text stream.
buffer
The character array to write.
public
void
WriteLine​(char[] buffer,
int index,
int count)
Writes a subarray of characters, followed by a line terminator, to the text stream.
buffer
The character array to write data from.
index
Starting index in the buffer.
count
The number of characters to write.
public
void
WriteLine​(double value)
Writes the text representation of a Double, followed by a line terminator, to the text stream.
value
The <see langword="double" /> to write.
public
void
WriteLine​(int value)
Writes the text representation of an integer, followed by a line terminator, to the text stream.
value
The integer to write.
public
void
WriteLine​(long value)
Writes the text representation of an 8-byte integer, followed by a line terminator, to the text stream.
value
The 8-byte integer to write.
public
void
WriteLine​(object value)
Writes the text representation of an object, followed by a line terminator, to the text stream.
value
The object to write.
public
void
WriteLine​(Single value)
Writes the text representation of a Single, followed by a line terminator, to the text stream.
value
The <see langword="single" /> to write.
public
void
WriteLine​(string s)
Writes the specified string, followed by a line terminator, to the text stream.
s
The string to write.
public
void
WriteLine​(string format,
object arg0)
Writes out a formatted string, followed by a line terminator, using the same semantics as specified.
format
The formatting string.
arg0
The object to write into the formatted string.
public
void
WriteLine​(string format,
object arg0,
object arg1)
Writes out a formatted string, followed by a line terminator, using the same semantics as specified.
format
The formatting string to use.
arg0
The first object to write into the formatted string.
arg1
The second object to write into the formatted string.
public
void
WriteLine​(string format,
object[] arg)
Writes out a formatted string, followed by a line terminator, using the same semantics as specified.
format
The formatting string to use.
arg
The argument array to output.
public
void
WriteLine​(string format,
ReadOnlySpan<​object> arg)
Writes out a formatted string, followed by a line terminator, using the same semantics as specified.
format
The formatting string to use.
arg
The argument span to output.
public
void
WriteLine​(uint value)
Writes the text representation of a UInt32, followed by a line terminator, to the text stream.
value
A UInt32 to output.
WriteLineAsync​()
Asynchronously writes the line terminator to the underlying <see cref="T:System.IO.TextWriter" /> .
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous line writing operation.
WriteLineAsync​(char value)
Asynchronously writes the specified <see cref="T:System.Char" /> to the underlying <see cref="T:System.IO.TextWriter" /> followed by a line terminator, inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The character to write.
WriteLineAsync​(char[] buffer,
int index,
int count)
Asynchronously writes the specified number of characters from the specified buffer followed by a line terminator, to the underlying <see cref="T:System.IO.TextWriter" /> , starting at the specified index within the buffer, inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
buffer
The buffer containing characters to write.
index
The index within the buffer to start writing at.
count
The number of characters to write.
WriteLineAsync​(ReadOnlyMemory<​char> buffer,
Threading.​CancellationToken cancellationToken = null)
Asynchronously writes the specified characters followed by a line terminator to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
buffer
The characters to write.
cancellationToken
Token for canceling the operation.
WriteLineAsync​(string value)
Asynchronously writes the specified string followed by a line terminator to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The string to write.
WriteLineAsync​(Text.​StringBuilder? value,
Threading.​CancellationToken cancellationToken = null)
Asynchronously writes the contents of the specified <see cref="T:System.Text.StringBuilder" /> followed by a line terminator to the underlying <see cref="T:System.IO.TextWriter" /> , inserting tabs at the start of every line.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
value
The text to write.
cancellationToken
Token for canceling the operation.
public
void
WriteLineNoTabs​(string s)
Writes the specified string to a line without tabs.
s
The string to write.
WriteLineNoTabsAsync​(string s)
Asynchronously writes the specified string to the underlying <see cref="T:System.IO.TextWriter" /> without inserting tabs.
Returns A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.
s
The string to write.
public
void
Dispose​()
Inherited from IO.​TextWriter
Releases all resources used by the <see cref="T:System.IO.TextWriter" /> object.
protected
void
Dispose​(bool disposing)
Inherited from IO.​TextWriter
Releases the unmanaged resources used by the <see cref="T:System.IO.TextWriter" /> and optionally releases the managed resources.
disposing
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
public
void
Write​(decimal value)
Inherited from IO.​TextWriter
Writes the text representation of a decimal value to the text stream.
value
The decimal value to write.
public
void
Write​(ReadOnlySpan<​char> buffer)
Inherited from IO.​TextWriter
Writes a character span to the text stream.
buffer
The character span to write.
public
void
Write​(string format,
object arg0,
object arg1,
object arg2)
Inherited from IO.​TextWriter
Writes a formatted string to the text stream, using the same semantics as the <see cref="M:System.String.Format(System.String,System.Object,System.Object,System.Object)" /> method.
format
A composite format string.
arg0
The first object to format and write.
arg1
The second object to format and write.
arg2
The third object to format and write.
public
void
Write​(Text.​StringBuilder value)
Inherited from IO.​TextWriter
Writes a string builder to the text stream.
value
The string, as a string builder, to write to the text stream.
public
void
Write​(uint value)
Inherited from IO.​TextWriter
Writes the text representation of a 4-byte unsigned integer to the text stream.
value
The 4-byte unsigned integer to write.
public
void
Write​(ulong value)
Inherited from IO.​TextWriter
Writes the text representation of an 8-byte unsigned integer to the text stream.
value
The 8-byte unsigned integer to write.
WriteAsync​(char[] buffer)
Inherited from IO.​TextWriter
Writes a character array to the text stream asynchronously.
Returns A task that represents the asynchronous write operation.
buffer
The character array to write to the text stream. If <paramref name="buffer" /> is <see langword="null" /> , nothing is written.
public
void
WriteLine​(decimal value)
Inherited from IO.​TextWriter
Writes the text representation of a decimal value to the text stream, followed by a line terminator.
value
The decimal value to write.
public
void
WriteLine​(ReadOnlySpan<​char> buffer)
Inherited from IO.​TextWriter
Writes the text representation of a character span to the text stream, followed by a line terminator.
buffer
The char span value to write to the text stream.
public
void
WriteLine​(string format,
object arg0,
object arg1,
object arg2)
Inherited from IO.​TextWriter
Writes out a formatted string and a new line to the text stream, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" /> .
format
A composite format string.
arg0
The first object to format and write.
arg1
The second object to format and write.
arg2
The third object to format and write.
public
void
WriteLine​(Text.​StringBuilder value)
Inherited from IO.​TextWriter
Writes the text representation of a string builder to the text stream, followed by a line terminator.
value
The string, as a string builder, to write to the text stream.
public
void
WriteLine​(ulong value)
Inherited from IO.​TextWriter
Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.
value
The 8-byte unsigned integer to write.
WriteLineAsync​(char[] buffer)
Inherited from IO.​TextWriter
Asynchronously writes an array of characters to the text stream, followed by a line terminator.
Returns A task that represents the asynchronous write operation.
buffer
The character array to write to the text stream. If the character array is <see langword="null" /> , only the line terminator is written.
public
object
GetLifetimeService​()
Inherited from MarshalByRefObject
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
Returns An object of type <see cref="T:System.Runtime.Remoting.Lifetime.ILease" /> used to control the lifetime policy for this instance.
public
object
InitializeLifetimeService​()
Inherited from MarshalByRefObject
Obtains a lifetime service object to control the lifetime policy for this instance.
Returns An object of type <see cref="T:System.Runtime.Remoting.Lifetime.ILease" /> used to control the lifetime policy for this instance. This is the current lifetime service object for this instance if one exists; otherwise, a new lifetime service object initialized to the value of the <see cref="P:System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseManagerPollTime" /> property.
protected
MarshalByRefObject
MemberwiseClone​(bool cloneIdentity)
Inherited from MarshalByRefObject
Creates a shallow copy of the current <see cref="T:System.MarshalByRefObject" /> object.
Returns A shallow copy of the current <see cref="T:System.MarshalByRefObject" /> object.
cloneIdentity
<see langword="false" /> to delete the current <see cref="T:System.MarshalByRefObject" /> object's identity, which will cause the object to be assigned a new identity when it is marshaled across a remoting boundary. A value of <see langword="false" /> is usually appropriate. <see langword="true" /> to copy the current <see cref="T:System.MarshalByRefObject" /> object's identity to its clone, which will cause remoting client calls to be routed to the remote server object.
public
bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.