Create Culture info in es-US

image_pdfimage_print
   


using System;
using System.Globalization;

class Class1 {
  static void Main(string[] args) {
         CultureInfo MyCulture = new CultureInfo("es-ES");
         DateTimeFormatInfo Myfmt;
         DateTimeFormatInfo fmt1;

         Myfmt = MyCulture.DateTimeFormat;
         fmt1  = DateTimeFormatInfo.CurrentInfo;

         Console.WriteLine(Myfmt.GetMonthName(12));
         Console.WriteLine(fmt1.GetMonthName(12));
      }
}


           
          


Use CultureAndRegionInfoBuilder

image_pdfimage_print
   


using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;



class Program {
    static void Main(string[] args) {

        CultureAndRegionInfoBuilder styria = new CultureAndRegionInfoBuilder(
            "de-AT-ST", CultureAndRegionModifiers.None);
        styria.LoadDataFromCultureInfo(new CultureInfo("de-AT"));
        styria.LoadDataFromRegionInfo(new RegionInfo("AT"));

        styria.Register();

    }
}
           
          


X, F1, Z, Escape key from ConsoleKey

image_pdfimage_print

using System;
using System.Collections.Generic;

class MainClass
{
public static void Main()
{
ConsoleKeyInfo key;

List input = new List();

do{
key = Console.ReadKey(true);
if (key.Key == ConsoleKey.F1)
{
Console.WriteLine(“F1”);
}
if (key.Key == ConsoleKey.Backspace)
{
if (input.Count > 0)
{
input.RemoveAt(input.Count – 1);

Console.Write(key.KeyChar);
}
}else if (key.Key == ConsoleKey.Escape){
Console.Clear();
Console.WriteLine(“Input: {0}

“,new String(input.ToArray()));
input.Clear();
}else if (key.Key >= ConsoleKey.A && key.Key <= ConsoleKey.Z){ input.Add(key.KeyChar); Console.Write(key.KeyChar); } } while (key.Key != ConsoleKey.X || key.Modifiers != ConsoleModifiers.Alt); } } [/csharp]