C# StringWriter StringWriter()

Description

StringWriter StringWriter() Initializes a new instance of the StringWriter class.

Syntax

StringWriter.StringWriter() has the following syntax.


public StringWriter()

Example

The following code example demonstrates how to construct a string using the StringWriter class.


// ww w.  j  ava  2 s.  com
using System;
using System.IO;
using System.Text;

class StrWriter
{
    static void Main()
    {
        StringWriter strWriter  = new StringWriter();
        strWriter.Write("from java2s.com");
        strWriter.Write('.');

        Console.WriteLine(strWriter.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter