Export (0) Print
Expand All

CultureAndRegionModifiers Enumeration

Specifies constants that define a CultureAndRegionInfoBuilder object.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Globalization
Assembly:  sysglobl (in sysglobl.dll)

[FlagsAttribute]
public enum CultureAndRegionModifiers

Member nameDescription
NoneA specific, supplemental custom culture.
NeutralA neutral custom culture.
ReplacementA custom culture that replaces an existing .NET Framework culture or Windows locale.

Specify a bitwise combination of one or more CultureAndRegionModifiers values as a parameter of the CultureAndRegionInfoBuilder.CultureAndRegionInfoBuilder(String, CultureAndRegionModifiers) constructor. The application should use the resulting CultureAndRegionInfoBuilder object to create a custom culture.

A custom culture can have a combination of these characteristics:

  • A custom culture can be a specific culture or a neutral culture.

    A specific culture specifies a language and a region, while a neutral culture specifies a language but no region.

  • A custom culture can be a replacement culture or a supplemental culture.

    A replacement culture replaces a culture that ships with the .NET Framework or a locale that ships with Windows.

    A supplemental culture is anything other than a replacement culture. A supplemental culture can be entirely new, or can extend an existing .NET Framework culture or Windows locale.

The following code example creates a custom culture with a private use prefix, then lists a set of its properties. The first property is the name of the culture.


// This example demonstrates a System.Globalization.Culture-
// AndRegionInfoBuilder constructor and some of the properties 
// of the CultureAndRegionInfoBuilder object that is created.
// Compile this example with a reference to sysglobl.dll.

using System;
using System.Globalization;

class Sample 
{
    public static void Main() 
    {

// Construct a new, privately used culture that extends the en-US culture 
// provided by the .NET Framework. In this sample, the CultureAndRegion-
// Types.Specific parameter creates a minimal CultureAndRegionInfoBuilder 
// object that you must populate with culture and region information.

    CultureAndRegionInfoBuilder cib = null;
    try {
        cib = new CultureAndRegionInfoBuilder(
                                          "x-en-US-sample",
                                          CultureAndRegionModifiers.None);
        }
    catch (ArgumentException ae)
        {
        Console.WriteLine(ae);
        return;
        }

// Populate the new CultureAndRegionInfoBuilder object with culture information.

    CultureInfo ci = new CultureInfo("en-US");
    cib.LoadDataFromCultureInfo(ci);

// Populate the new CultureAndRegionInfoBuilder object with region information.

    RegionInfo  ri = new RegionInfo("US");
    cib.LoadDataFromRegionInfo(ri);

// Display some of the properties for the x-en-US-sample custom culture.

    Console.Clear();
    Console.WriteLine("CultureName:. . . . . . . . . . {0}", cib.CultureName);
    Console.WriteLine("CultureEnglishName: . . . . . . {0}", cib.CultureEnglishName);
    Console.WriteLine("CultureNativeName:. . . . . . . {0}", cib.CultureNativeName);
    Console.WriteLine("GeoId:. . . . . . . . . . . . . {0}", cib.GeoId);
    Console.WriteLine("IsMetric: . . . . . . . . . . . {0}", cib.IsMetric);
    Console.WriteLine("ISOCurrencySymbol:. . . . . . . {0}", cib.ISOCurrencySymbol);
    Console.WriteLine("RegionEnglishName:. . . . . . . {0}", cib.RegionEnglishName);
    Console.WriteLine("RegionName: . . . . . . . . . . {0}", cib.RegionName);
    Console.WriteLine("RegionNativeName: . . . . . . . {0}", cib.RegionNativeName);
    Console.WriteLine("ThreeLetterISOLanguageName: . . {0}", cib.ThreeLetterISOLanguageName);
    Console.WriteLine("ThreeLetterISORegionName: . . . {0}", cib.ThreeLetterISORegionName);
    Console.WriteLine("ThreeLetterWindowsLanguageName: {0}", cib.ThreeLetterWindowsLanguageName);
    Console.WriteLine("ThreeLetterWindowsRegionName: . {0}", cib.ThreeLetterWindowsRegionName);
    Console.WriteLine("TwoLetterISOLanguageName: . . . {0}", cib.TwoLetterISOLanguageName);
    Console.WriteLine("TwoLetterISORegionName: . . . . {0}", cib.TwoLetterISORegionName);
    }
}
/*
This code example produces the following results:

CultureName:. . . . . . . . . . x-en-US-sample
CultureEnglishName: . . . . . . English
CultureNativeName:. . . . . . . English
GeoId:. . . . . . . . . . . . . 244
IsMetric: . . . . . . . . . . . False
ISOCurrencySymbol:. . . . . . . USD
RegionEnglishName:. . . . . . . United States
RegionName: . . . . . . . . . . US
RegionNativeName: . . . . . . . United States
ThreeLetterISOLanguageName: . . eng
ThreeLetterISORegionName: . . . USA
ThreeLetterWindowsLanguageName: ENU
ThreeLetterWindowsRegionName: . USA
TwoLetterISOLanguageName: . . . en
TwoLetterISORegionName: . . . . US

*/


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft