illustrates the CultureInfo class 2

   

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example21_7.cs illustrates the CultureInfo class
*/

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

public class Example21_7 
{

  public static void Main() 
  {
    // create a CultureInfo object for the nl-BE culture
    CultureInfo ci = new CultureInfo("nl-BE");

    // create a file to hold the results
    FileStream outStream = File.Create("CultureInfo.txt");

    // use a StreamWriter to write data to the file
    StreamWriter sw = new StreamWriter(outStream);

    // show some basic information
    sw.WriteLine("Native Name: " + ci.NativeName);
    sw.WriteLine("English Name: " + ci.EnglishName);

    // get datetime formatting info
    DateTimeFormatInfo dtfi = ci.DateTimeFormat;
    sw.WriteLine("Long date pattern: " + dtfi.LongDatePattern);

    // get numeric formatting info
    NumberFormatInfo nfi = ci.NumberFormat;
    sw.WriteLine("Currency symbol: " + nfi.CurrencySymbol);
    sw.WriteLine("Decimal seperator: " + nfi.NumberDecimalSeparator);

    // flush and close the file
    sw.Flush();
    sw.Close();

  }

}