Name
StringWriter
Synopsis
This class provides an alternative
to using a
System.Text.StringBuilder
to create a string. This
allows you to create a string in the exact same manner you would
create a text file, which can be very useful. It implements all of
the TextWriter
methods.
public class StringWriter : TextWriter { // Public Constructors public StringWriter( ); public StringWriter(IFormatProviderformatProvider
); public StringWriter(System.Text.StringBuildersb
); public StringWriter(System.Text.StringBuildersb
, IFormatProviderformatProvider
); // Public Instance Properties public override Encoding Encoding{get; } // overrides TextWriter // Public Instance Methods public override void Close( ); // overrides TextWriter public virtual StringBuilder GetStringBuilder( ); public override string ToString( ); // overrides object public override void Write(charvalue
); // overrides TextWriter public override void Write(char[ ]buffer
, intindex
, intcount
) // overrides TextWriter public override void Write(stringvalue
); // overrides TextWriter // Protected Instance Methods protected override void Dispose(bool disposing) // overrides TextWriter }
Hierarchy
System.Object
→
System.MarshalByRefObject
→
TextWriter(System.IDisposable)
→
StringWriter
Get C# in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.