Initializes a new instance of the StringWriter class.
using System;
using System.IO;
using System.Text;
class StrWriter
{
static void Main()
{
StringWriter strWriter = new StringWriter();
strWriter.Write("file path characters are: ");
strWriter.Write(
Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
strWriter.Write('.');
strWriter.GetStringBuilder().Insert(0, "Invalid ");
Console.WriteLine("The following string is {0} encoded.\n{1}",
strWriter.Encoding.EncodingName, strWriter.ToString());
}
}
Related examples in the same category