O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 method StringWriter();  
   public method StringWriter(
        IFormatProvider formatProvider);  
   public method StringWriter(System.Text.StringBuilder sb);  
   public method StringWriter(System.Text.StringBuilder sb, 
        IFormatProvider formatProvider);  
// Public Instance Properties
   public override field Encoding Encoding{get; }                // overrides TextWriter
                  // Public Instance Methods
   public override method void Close();                          // overrides TextWriter
   public virtual method StringBuilder GetStringBuilder();  
   public override method string ToString();                     // overrides object
   public override method void Write(char value);               // overrides TextWriter
   public override method void Write(char[] buffer, int index,   // overrides TextWriter
        int count);  
   public override method void Write(string value);             // overrides TextWriter
                  // Protected Instance Methods
   protected override method void Dispose(bool disposing);      // overrides TextWriter
}

Hierarchy

System.ObjectSystem.MarshalByRefObjectTextWriter(System.IDisposable)StringWriter

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required