|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Classe CultureInfo
Assembly: mscorlib (em mscorlib.dll)
O tipo CultureInfo expõe os membros a seguir.
| Nome | Descrição | |
|---|---|---|
![]() ![]() | CultureInfo(Int32) | |
![]() ![]() | CultureInfo(String) | |
![]() ![]() | CultureInfo(Int32, Boolean) | |
![]() ![]() | CultureInfo(String, Boolean) |
| Nome | Descrição | |
|---|---|---|
![]() ![]() | Calendar | |
![]() ![]() | CompareInfo | |
![]() | CultureTypes | |
![]() ![]() ![]() | CurrentCulture | |
![]() ![]() ![]() | CurrentUICulture | |
![]() ![]() | DateTimeFormat | |
![]() | DisplayName | |
![]() ![]() | EnglishName | |
![]() | IetfLanguageTag | |
![]() ![]() | InstalledUICulture | |
![]() ![]() ![]() | InvariantCulture | |
![]() ![]() | IsNeutralCulture | |
![]() ![]() | IsReadOnly | |
![]() | KeyboardLayoutId | |
![]() ![]() | LCID | |
![]() ![]() | Name | |
![]() ![]() | NativeName | |
![]() ![]() | NumberFormat | |
![]() ![]() | OptionalCalendars | |
![]() ![]() | Parent | |
![]() ![]() | TextInfo | |
![]() ![]() | ThreeLetterISOLanguageName | |
![]() ![]() | ThreeLetterWindowsLanguageName | |
![]() ![]() | TwoLetterISOLanguageName | |
![]() ![]() | UseUserOverride |
| Nome | Descrição | |
|---|---|---|
![]() ![]() | ClearCachedData | |
![]() ![]() | Clone | |
![]() ![]() ![]() | CreateSpecificCulture | |
![]() ![]() | Equals | |
![]() ![]() | Finalize | |
![]() | GetConsoleFallbackUICulture | |
![]() ![]() ![]() | GetCultureInfo(Int32) | |
![]() ![]() ![]() | GetCultureInfo(String) | |
![]() ![]() | GetCultureInfo(String, String) | |
![]() ![]() | GetCultureInfoByIetfLanguageTag | |
![]() ![]() | GetCultures | |
![]() ![]() | GetFormat | |
![]() ![]() | GetHashCode | |
![]() ![]() | GetType | |
![]() ![]() | MemberwiseClone | |
![]() ![]() ![]() | ReadOnly | |
![]() ![]() | ToString |
Identificadores e nomes de culturas
Observação |
|---|
Constante, neutro e culturas específicas
Culturas personalizadas
Culturas personalizadas podem ter valores que excedem os intervalos das culturas fornecido a Microsoft. Por exemplo, algumas culturas têm nomes de meses anormalmente longo, data inesperada ou formatos de hora ou outros dados incomuns. Respeitar os valores de dados de cultura do usuário; Por exemplo, o usuário poderá um relógio de 24 horas ou em um formato de data aaaammdd. Lembre-se de culturas personalizadas substituam os valores padrão. Portanto, você não pode considerar os dados de cultura a ser estável. Nomes de países, formatos de data, erros de ortografia, etc., provavelmente será alterado no futuro. Se seu aplicativo precisar serializar usando esses dados, como para o DateTime formatação e análise de funções, ele deve usar a cultura invariável ou em um formato específico.
Dados dinâmicos de cultura
Cuidado |
|---|
Serialização de objeto CultureInfo
Se CultureTypes indica CultureTypes.WindowsOnlyCultures, e se essa cultura foi introduzida no Windows Vista, não é possível desserializar a ele no Windows XP. Da mesma forma, se a cultura foi introduzida no Windows XP Service Pack 2, não é possível desserializá-lo para um sistema Windows XP no qual a cultura não foi instalada. Se CultureTypes indica CultureTypes.UserCustomCulturee o computador no qual está de-serialized não tem essa cultura personalizada de usuário instalada, não é possível desserializar o proprietário. Se CultureTypes indica CultureTypes.ReplacementCulturese o computador no qual está de-serialized não tem essa cultura substituta, ele desfaz a serialização do mesmo nome, mas nem todas as mesmas características. Por exemplo, se "en-US" é uma cultura de substituição no computador A, mas não no computador b e se um CultureInfo objeto referindo-se a essa cultura é serializado no computador a e ser desserializado no computador B, em seguida, nenhuma das características da cultura personalizadas são transmitidas. A cultura desfaz a serialização do êxito, mas com um significado diferente.
Localidades do Windows
Substituições de painel de controle
Ordens de classificação alternativo
Implemented Interfaces
Culturas, segmentos e domínios de aplicativo
using System; using System.Collections; using System.Globalization; public class SamplesCultureInfo { public static void Main() { // Creates and initializes the CultureInfo which uses the international sort. CultureInfo myCIintl = new CultureInfo("es-ES", false); // Creates and initializes the CultureInfo which uses the traditional sort. CultureInfo myCItrad = new CultureInfo(0x040A, false); // Displays the properties of each culture. Console.WriteLine("{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL"); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Name", myCIintl.Name, myCItrad.Name); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName); Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TwoLetterISOLanguageName", myCIintl.TwoLetterISOLanguageName, myCItrad.TwoLetterISOLanguageName); Console.WriteLine(); // Compare two strings using myCIintl. Console.WriteLine("Comparing \"llegar\" and \"lugar\""); Console.WriteLine(" With myCIintl.CompareInfo.Compare: {0}", myCIintl.CompareInfo.Compare("llegar", "lugar")); Console.WriteLine(" With myCItrad.CompareInfo.Compare: {0}", myCItrad.CompareInfo.Compare("llegar", "lugar")); } } /* This code produces the following output. PROPERTY INTERNATIONAL TRADITIONAL CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl DisplayName Spanish (Spain) Spanish (Spain) EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort) IsNeutralCulture False False IsReadOnly False False LCID 3082 1034 Name es-ES es-ES NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional) Parent es es TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl ThreeLetterISOLanguageName spa spa ThreeLetterWindowsLanguageName ESN ESP TwoLetterISOLanguageName es es Comparing "llegar" and "lugar" With myCIintl.CompareInfo.Compare: -1 With myCItrad.CompareInfo.Compare: 1 */
Observação |
|---|
using System; using System.Globalization; public class SamplesCultureInfo { public static void Main() { // Prints the header. Console.WriteLine("SPECIFIC CULTURE PARENT CULTURE"); // Determines the specific cultures that use the Chinese language, and displays the parent culture. foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { if (ci.TwoLetterISOLanguageName == "zh") { Console.Write("0x{0} {1} {2,-40}", ci.LCID.ToString("X4"), ci.Name, ci.EnglishName); Console.WriteLine("0x{0} {1} {2}", ci.Parent.LCID.ToString("X4"), ci.Parent.Name, ci.Parent.EnglishName); } } } } /* This code produces the following output. SPECIFIC CULTURE PARENT CULTURE 0x0404 zh-TW Chinese (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy 0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy 0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy 0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy 0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy */
Windows 7, Windows Vista SP1 ou posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core não compatível), Windows Server 2008 R2 (Server Core não compatível com SP1 ou posterior), Windows Server 2003 SP2
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte Requisitos de sistema do .NET Framework.
