CultureAndRegionModifiers Перечисление

Определение

Указывает константы, которые определяют объект CultureAndRegionInfoBuilder.

Это перечисление поддерживает побитовую комбинацию значений его членов.

public enum class CultureAndRegionModifiers
[System.Flags]
public enum CultureAndRegionModifiers
[<System.Flags>]
type CultureAndRegionModifiers = 
Public Enum CultureAndRegionModifiers
Наследование
CultureAndRegionModifiers
Атрибуты

Поля

Neutral 1

Нейтральный пользовательский язык и региональные параметры.

None 0

Определенный дополнительный пользовательский язык и региональные параметры.

Replacement 2

Пользовательский язык и региональные параметры, которые замещают существующий язык и региональные параметры .NET или языковой стандарт Windows.

Примеры

В следующем примере кода создается настраиваемый язык и региональные параметры с префиксом частного использования, а затем выводится список его свойств. Первое свойство — это имя языка и региональных параметров.

// This example demonstrates a System.Globalization.Culture-
// AndRegionInfoBuilder constructor and some of the properties 
// of a custom culture object created with the constructor.

#using <sysglobl.dll>

using namespace System;
using namespace System::Globalization;

int main()
{
    CultureAndRegionInfoBuilder^ builder = 
        gcnew CultureAndRegionInfoBuilder
        ("x-en-US-sample", CultureAndRegionModifiers::None);
    
    // Display some of the properties 
    // for the en-US culture.
    Console::WriteLine("CultureName:. . . . . . . . . . {0}", 
        builder->CultureName);
    Console::WriteLine("CultureEnglishName: . . . . . . {0}", 
        builder->CultureEnglishName);
    Console::WriteLine("CultureNativeName:. . . . . . . {0}", 
        builder->CultureNativeName);
    Console::WriteLine("GeoId:. . . . . . . . . . . . . {0}", 
        builder->GeoId);
    Console::WriteLine("IsMetric: . . . . . . . . . . . {0}", 
        builder->IsMetric);
    Console::WriteLine("ISOCurrencySymbol:. . . . . . . {0}", 
        builder->ISOCurrencySymbol);
    Console::WriteLine("RegionEnglishName:. . . . . . . {0}", 
        builder->RegionEnglishName);
    Console::WriteLine("RegionName: . . . . . . . . . . {0}", 
        builder->RegionName);
    Console::WriteLine("RegionNativeName: . . . . . . . {0}", 
        builder->RegionNativeName);
    Console::WriteLine("ThreeLetterISOLanguageName: . . {0}", 
        builder->ThreeLetterISOLanguageName);
    Console::WriteLine("ThreeLetterISORegionName: . . . {0}", 
        builder->ThreeLetterISORegionName);
    Console::WriteLine("ThreeLetterWindowsLanguageName: {0}", 
        builder->ThreeLetterWindowsLanguageName);
    Console::WriteLine("ThreeLetterWindowsRegionName: . {0}", 
        builder->ThreeLetterWindowsRegionName);
    Console::WriteLine("TwoLetterISOLanguageName: . . . {0}", 
        builder->TwoLetterISOLanguageName);
    Console::WriteLine("TwoLetterISORegionName: . . . . {0}", 
        builder->TwoLetterISORegionName);
}

/*
This code example produces the following results:

CultureName:. . . . . . . . . . en-US
CultureEnglishName: . . . . . . English (United States)
CultureNativeName:. . . . . . . English (United States)
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

*/
// 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

*/
' 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.

Imports System.Globalization

Class Sample
    Public Shared Sub 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.

        Dim cib As CultureAndRegionInfoBuilder = Nothing
        Try
            cib = New CultureAndRegionInfoBuilder("x-en-US-sample", _
                                                   CultureAndRegionModifiers.None)
        Catch ae As ArgumentException
            Console.WriteLine(ae)
            Return
        End Try
        
        ' Populate the new CultureAndRegionInfoBuilder object with culture information.

        Dim ci As New CultureInfo("en-US")
        cib.LoadDataFromCultureInfo(ci)
        
        ' Populate the new CultureAndRegionInfoBuilder object with region information.

        Dim ri As 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)
    
    End Sub
End Class
'
'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
'

Комментарии

Укажите побитовое сочетание одного или нескольких CultureAndRegionModifiers значений в качестве аргумента конструктора CultureAndRegionInfoBuilder.CultureAndRegionInfoBuilder(String, CultureAndRegionModifiers) . Результирующий CultureAndRegionInfoBuilder объект используется для создания пользовательского языка и региональных параметров.

Настраиваемый язык и региональные параметры могут иметь сочетание следующих характеристик:

  • Пользовательский язык и региональные параметры могут быть определенным языком и региональными параметрами или нейтральными.

    Определенный язык и региональные параметры определяют язык и регион, а нейтральный язык и региональные параметры не указывают язык, но не регион.

  • Пользовательский язык и региональные параметры могут быть языком и региональными параметрами замены или дополнительными языками и региональными параметрами.

    Язык замены заменяет культуру, которая поставляется с платформа .NET Framework или языковым стандартом, который поставляется с Windows.

    Дополнительная культура — это что-нибудь другое, кроме замены культуры. Дополнительный язык и региональные параметры могут быть совершенно новыми или расширить существующий язык и региональные параметры платформа .NET Framework или Windows языкового стандарта.

Важно!

Обратите внимание, что перечисление CultureAndRegionModifiers находится в сборке с именем sysglobl.dll. Для успешной компиляции кода, использующего этот тип, требуется добавить ссылку на sysglobl.dll.

Применяется к

См. также раздел