Sunday, 3 December 2017

C# Program to Demonstrate Culture Names


Code:

using System;
using System.Globalization;
using System.Threading;
public class Info : MarshalByRefObject
{
    public void ShowCurrentCulture()
    {
        Console.WriteLine("Culture of {0} in application domain {1}: {2}",Thread.CurrentThread.Name,AppDomain.CurrentDomain.FriendlyName,CultureInfo.CurrentCulture.Name);
    }
}
public class Example
{
    public static void Main()
    {
        Info inf = new Info();
        Thread.CurrentThread.Name = "MainThread";
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("nl-NL");
        inf.ShowCurrentCulture();
        AppDomain ad = AppDomain.CreateDomain("Domain2");
        Info inf2 = (Info)ad.CreateInstanceAndUnwrap(typeof(Info).Assembly.FullName, "Info");
        inf2.ShowCurrentCulture();
        Console.ReadLine();
    }
}


Output:

Culture of MainThread in application domain ConsoleApplication32.vshoot.exe : nl-NL 
Culture of MainThread in application domain Domain2 : nl-NL


More C# Programs:





















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...