Initializes a new instance of the StringWriter class that writes to the specified StringBuilder.
using System;
using System.IO;
using System.Text;
class StrWriter
{
static void Main()
{
StringBuilder strBuilder =
new StringBuilder("file path characters are: ");
StringWriter strWriter = new StringWriter(strBuilder);
strWriter.Write(
Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
strWriter.Close();
strBuilder.Insert(0, "Invalid ");
Console.WriteLine(strWriter.ToString());
}
}
Related examples in the same category