Customer CultureInfo in .net
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
namespace CultureInformationCS
{
class Program
{
static void Main(string[] args)
{
DateTimeFormatInfo DateInfo = new DateTimeFormatInfo();
DateInfo.DateSeparator = ",";
DateInfo.DayNames = new String[] { "First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh" };
NumberFormatInfo NumberInfo = new NumberFormatInfo();
NumberInfo.CurrencySymbol = "J";
NumberInfo.CurrencyDecimalDigits = 4;
CultureInfo JoeyCulture = new CultureInfo("en-US");
JoeyCulture.DateTimeFormat = DateInfo;
JoeyCulture.NumberFormat = NumberInfo;
RegionInfo JoeyRegion = new RegionInfo("en-US");
CultureAndRegionInfoBuilder JoeyBuilder = new CultureAndRegionInfoBuilder("Joey", CultureAndRegionModifiers.None);
JoeyBuilder.LoadDataFromCultureInfo(JoeyCulture);
JoeyBuilder.LoadDataFromRegionInfo(JoeyRegion);
try
{
JoeyBuilder.Register();
}
catch
{
}
CultureInfo UserCulture = new CultureInfo("Joey");
String[] Days = UserCulture.DateTimeFormat.DayNames;
foreach (String Day in Days)
{
Console.WriteLine("Day name for " + UserCulture.DisplayName + " " + Day);
}
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
namespace CultureInformationCS
{
class Program
{
static void Main(string[] args)
{
DateTimeFormatInfo DateInfo = new DateTimeFormatInfo();
DateInfo.DateSeparator = ",";
DateInfo.DayNames = new String[] { "First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh" };
NumberFormatInfo NumberInfo = new NumberFormatInfo();
NumberInfo.CurrencySymbol = "J";
NumberInfo.CurrencyDecimalDigits = 4;
CultureInfo JoeyCulture = new CultureInfo("en-US");
JoeyCulture.DateTimeFormat = DateInfo;
JoeyCulture.NumberFormat = NumberInfo;
RegionInfo JoeyRegion = new RegionInfo("en-US");
CultureAndRegionInfoBuilder JoeyBuilder = new CultureAndRegionInfoBuilder("Joey", CultureAndRegionModifiers.None);
JoeyBuilder.LoadDataFromCultureInfo(JoeyCulture);
JoeyBuilder.LoadDataFromRegionInfo(JoeyRegion);
try
{
JoeyBuilder.Register();
}
catch
{
}
CultureInfo UserCulture = new CultureInfo("Joey");
String[] Days = UserCulture.DateTimeFormat.DayNames;
foreach (String Day in Days)
{
Console.WriteLine("Day name for " + UserCulture.DisplayName + " " + Day);
}
Console.ReadLine();
}
}
}
VB.NET:
Imports System.Threading
Imports System.Globalization
Module Module1
Sub Main()
Dim DateInfo As New DateTimeFormatInfo
DateInfo.DateSeparator = ","
DateInfo.DayNames = New String() {"First", "Second", "Third", "Fourth", "Fiveth", "Sixth", "Seventh"}
Dim NumberInfo As New NumberFormatInfo
NumberInfo.CurrencySymbol = "J"
NumberInfo.CurrencyDecimalDigits = 4
Dim JoeyCulture As New CultureInfo("en-US")
JoeyCulture.DateTimeFormat = DateInfo
JoeyCulture.NumberFormat = NumberInfo
Dim JoeyRegion As New RegionInfo("en-US")
Dim JoeyBuilder As New CultureAndRegionInfoBuilder("Joey", CultureAndRegionModifiers.None)
JoeyBuilder.LoadDataFromCultureInfo(JoeyCulture)
JoeyBuilder.LoadDataFromRegionInfo(JoeyRegion)
Try
JoeyBuilder.Register()
Catch
End Try
Dim UserCulture As New CultureInfo("Joey")
Dim Days As String() = UserCulture.DateTimeFormat.DayNames
For Each Day As String In Days
Console.WriteLine("Day name for " + UserCulture.DisplayName + " " + Day)
Next
Console.ReadLine()
End Sub
End Module
Imports System.Globalization
Module Module1
Sub Main()
Dim DateInfo As New DateTimeFormatInfo
DateInfo.DateSeparator = ","
DateInfo.DayNames = New String() {"First", "Second", "Third", "Fourth", "Fiveth", "Sixth", "Seventh"}
Dim NumberInfo As New NumberFormatInfo
NumberInfo.CurrencySymbol = "J"
NumberInfo.CurrencyDecimalDigits = 4
Dim JoeyCulture As New CultureInfo("en-US")
JoeyCulture.DateTimeFormat = DateInfo
JoeyCulture.NumberFormat = NumberInfo
Dim JoeyRegion As New RegionInfo("en-US")
Dim JoeyBuilder As New CultureAndRegionInfoBuilder("Joey", CultureAndRegionModifiers.None)
JoeyBuilder.LoadDataFromCultureInfo(JoeyCulture)
JoeyBuilder.LoadDataFromRegionInfo(JoeyRegion)
Try
JoeyBuilder.Register()
Catch
End Try
Dim UserCulture As New CultureInfo("Joey")
Dim Days As String() = UserCulture.DateTimeFormat.DayNames
For Each Day As String In Days
Console.WriteLine("Day name for " + UserCulture.DisplayName + " " + Day)
Next
Console.ReadLine()
End Sub
End Module