Initializes a new instance of the StringWriter class with the specified format control. : StringWriter « File Stream « C# / C Sharp






Initializes a new instance of the StringWriter class with the specified format control.

 

using System;
using System.Globalization;
using System.IO;

class StrWriter
{
    static void Main()
    {
        StringWriter strWriter = new StringWriter(new CultureInfo("ar-DZ"));

        strWriter.Write(DateTime.Now);

        Console.WriteLine(
            "Current date and time using the invariant culture: {0}\n" +
            "Current date and time using the Algerian culture: {1}", 
            DateTime.Now.ToString(), strWriter.ToString());
    }
}

   
  








Related examples in the same category

1.Use StringWriter to write string
2.The hex dump program.
3.StringWriter implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.
4.Initializes a new instance of the StringWriter class that writes to the specified StringBuilder.
5.Initializes a new instance of the StringWriter class.