-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathCultureInfo.xml
More file actions
3773 lines (3306 loc) · 279 KB
/
CultureInfo.xml
File metadata and controls
3773 lines (3306 loc) · 279 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="CultureInfo" FullName="System.Globalization.CultureInfo">
<TypeSignature Language="C#" Value="public class CultureInfo : ICloneable, IFormatProvider" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CultureInfo extends System.Object implements class System.ICloneable, class System.IFormatProvider" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<TypeSignature Language="DocId" Value="T:System.Globalization.CultureInfo" />
<TypeSignature Language="VB.NET" Value="Public Class CultureInfo
Implements ICloneable, IFormatProvider" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<TypeSignature Language="F#" Value="type CultureInfo = class
 interface ICloneable
 interface IFormatProvider" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<TypeSignature Language="C++ CLI" Value="public ref class CultureInfo : ICloneable, IFormatProvider" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<TypeSignature Language="C#" Value="public class CultureInfo : IFormatProvider" FrameworkAlternate="netcore-1.0;netcore-1.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CultureInfo extends System.Object implements class System.IFormatProvider" FrameworkAlternate="netcore-1.0;netcore-1.1" />
<TypeSignature Language="VB.NET" Value="Public Class CultureInfo
Implements IFormatProvider" FrameworkAlternate="netcore-1.0;netcore-1.1" />
<TypeSignature Language="F#" Value="type CultureInfo = class
 interface IFormatProvider" FrameworkAlternate="netcore-1.0;netcore-1.1" />
<TypeSignature Language="C++ CLI" Value="public ref class CultureInfo : IFormatProvider" FrameworkAlternate="netcore-1.0;netcore-1.1" />
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="10.0.0.0" FrameworkAlternate="net-10.0" />
<TypeForwarding From="System.Globalization" FromVersion="10.0.0.0" To="System.Runtime" ToVersion="10.0.0.0" FrameworkAlternate="net-10.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="11.0.0.0" FrameworkAlternate="net-11.0" />
<TypeForwarding From="System.Globalization" FromVersion="11.0.0.0" To="System.Runtime" ToVersion="11.0.0.0" FrameworkAlternate="net-11.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="System.Globalization" FromVersion="5.0.0.0" To="System.Runtime" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="System.Globalization" FromVersion="6.0.0.0" To="System.Runtime" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="System.Globalization" FromVersion="7.0.0.0" To="System.Runtime" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="System.Globalization" FromVersion="8.0.0.0" To="System.Runtime" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.Runtime" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
<TypeForwarding From="System.Globalization" FromVersion="9.0.0.0" To="System.Runtime" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
<TypeForwarding From="System.Globalization" FromVersion="4.1.0.0" To="System.Runtime" ToVersion="4.2.0.0" FrameworkAlternate="netcore-2.0" />
<TypeForwarding From="System.Globalization" FromVersion="4.1.1.0" To="System.Runtime" ToVersion="4.2.1.0" FrameworkAlternate="netcore-2.1;netcore-2.2;netcore-3.0" />
<TypeForwarding From="System.Globalization" FromVersion="4.1.2.0" To="System.Runtime" ToVersion="4.2.2.0" FrameworkAlternate="netcore-3.1" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1">
<InterfaceName>System.ICloneable</InterfaceName>
</Interface>
<Interface FrameworkAlternate="netcore-3.1">
<InterfaceName>System.IFormatProvider</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="net-10.0;net-11.0;net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides information about a specific culture (called a *locale* for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Globalization.CultureInfo> class provides information associated with a specific culture, such as language, sublanguage, country/region, calendar, and conventions. This class also provides access to culture-specific instances of the <xref:System.Globalization.DateTimeFormatInfo>, <xref:System.Globalization.NumberFormatInfo>, <xref:System.Globalization.CompareInfo>, and <xref:System.Globalization.TextInfo> objects. These objects contain the information required for culture-specific operations, such as casing, formatting dates and numbers, and comparing strings. The <xref:System.Globalization.CultureInfo> class is used either directly or indirectly by classes that format, parse, or manipulate culture-specific data, such as <xref:System.String>, <xref:System.DateTime>, <xref:System.DateTimeOffset>, and the numeric types.
## Culture names and identifiers
The <xref:System.Globalization.CultureInfo> class specifies a unique name for each culture, based on RFC 4646. The name is a combination of an ISO 639 two-letter or three-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code associated with a country or region. In addition, for apps that are running under Windows 10 or later, culture names that correspond to valid BCP-47 language tags are supported.
> [!NOTE]
> When a culture name is passed to a class constructor or a method such as <xref:System.Globalization.CultureInfo.CreateSpecificCulture*> or <xref:System.Globalization.CultureInfo>, its case is not significant.
The format for the culture name based on RFC 4646 is *`languagecode2`*-*`country/regioncode2`*, where *`languagecode2`* is the two-letter language code and *`country/regioncode2`* is the two-letter subculture code. Examples include `ja-JP` for Japanese (Japan) and `en-US` for English (United States). In cases where a two-letter language code is not available, a three-letter code as defined in ISO 639-3 is used.
Some culture names also specify an ISO 15924 script. For example, Cyrl specifies the Cyrillic script and Latn specifies the Latin script. A culture name that includes a script uses the pattern *`languagecode2`*-*`scripttag`*-*`country/regioncode2`*. An example of this type of culture name is `uz-Cyrl-UZ` for Uzbek (Cyrillic, Uzbekistan). On Windows operating systems before Windows Vista, a culture name that includes a script uses the pattern *`languagecode2`*-*`country/regioncode2`*-*`scripttag`*, for example, `uz-UZ-Cyrl` for Uzbek (Cyrillic, Uzbekistan).
A neutral culture is specified by only the two-letter, lowercase language code. For example, `fr` specifies the neutral culture for French, and `de` specifies the neutral culture for German.
> [!NOTE]
> There are two culture names that contradict this rule. The cultures Chinese (Simplified), named `zh-Hans`, and Chinese (Traditional), named `zh-Hant`, are neutral cultures. The culture names represent the current standard and should be used unless you have a reason for using the older names `zh-CHS` and `zh-CHT`.
A culture identifier is a standard international numeric abbreviation and has the components necessary to uniquely identify one of the installed cultures. Your application can use predefined culture identifiers or define custom identifiers.
Certain predefined culture names and identifiers are used by this and other classes in the <xref:System.Globalization?displayProperty=fullName> namespace. For detailed culture information for Windows systems, see the **Language tag** column in the [list of language/region names supported by Windows](/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c). Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47).
The culture names and identifiers represent only a subset of cultures that can be found on a particular computer. Windows versions or service packs can change the available cultures. Applications can add custom cultures using the <xref:System.Globalization.CultureAndRegionInfoBuilder> class. Users can add their own custom cultures using the [Microsoft Locale Builder](https://www.microsoft.com/download/details.aspx?id=41158) tool. Microsoft Locale Builder is written in managed code using the `CultureAndRegionInfoBuilder` class.
Several distinct names are closely associated with a culture, notably the names associated with the following class members:
- <xref:System.Globalization.CultureInfo.ToString*?displayProperty=nameWithType>
- <xref:System.Globalization.CultureInfo.Name?displayProperty=nameWithType>
- <xref:System.Globalization.CompareInfo.Name?displayProperty=nameWithType>
## Invariant, neutral, and specific cultures
The cultures are generally grouped into three sets: invariant cultures, neutral cultures, and specific cultures.
An invariant culture is culture-insensitive. Your application specifies the invariant culture by name using an empty string ("") or by its identifier. <xref:System.Globalization.CultureInfo.InvariantCulture> defines an instance of the invariant culture. It is associated with the English language but not with any country/region. It is used in almost any method in the `Globalization` namespace that requires a culture.
A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, `fr` is the neutral name for the French culture, and `fr-FR` is the name of the specific French (France) culture. Note that Chinese (Simplified) and Chinese (Traditional) are also considered neutral cultures.
Creating an instance of a <xref:System.Globalization.CompareInfo> class for a neutral culture is not recommended because the data it contains is arbitrary. To display and sort data, specify both the language and region. Additionally, the <xref:System.Globalization.CompareInfo.Name> property of a <xref:System.Globalization.CompareInfo> object created for a neutral culture returns only the country and does not include the region.
The defined cultures have a hierarchy in which the parent of a specific culture is a neutral culture and the parent of a neutral culture is the invariant culture. The <xref:System.Globalization.CultureInfo.Parent> property contains the neutral culture associated with a specific culture. Custom cultures should define the <xref:System.Globalization.CultureInfo.Parent> property in conformance with this pattern.
If the resources for a specific culture are not available in the operating system, the resources for the associated neutral culture are used. If the resources for the neutral culture are not available, the resources embedded in the main assembly are used. For more information on the resource fallback process, see [Packaging and Deploying Resources](/dotnet/framework/resources/packaging-and-deploying-resources-in-desktop-apps).
The list of locales in the Windows API is slightly different from the list of cultures supported by .NET. If interoperability with Windows is required, for example, through the p/invoke mechanism, the application should use a specific culture that's defined for the operating system. Use of the specific culture ensures consistency with the equivalent Windows locale, which is identified with a locale identifier that is the same as <xref:System.Globalization.CultureInfo.LCID>.
A <xref:System.Globalization.DateTimeFormatInfo> or a <xref:System.Globalization.NumberFormatInfo> can be created only for the invariant culture or for specific cultures, not for neutral cultures.
If <xref:System.Globalization.DateTimeFormatInfo.Calendar?displayProperty=nameWithType> is the <xref:System.Globalization.TaiwanCalendar> but the <xref:System.Threading.Thread.CurrentCulture?displayProperty=nameWithType> is not set to `zh-TW`, then <xref:System.Globalization.DateTimeFormatInfo.NativeCalendarName?displayProperty=nameWithType>, <xref:System.Globalization.DateTimeFormatInfo.GetEraName*?displayProperty=nameWithType>, and <xref:System.Globalization.DateTimeFormatInfo.GetAbbreviatedEraName*?displayProperty=nameWithType> return an empty string ("").
## Custom cultures
On Windows, you can create custom locales. For more information, see [Custom locales](/windows/win32/intl/custom-locales).
## CultureInfo and cultural data
.NET derives its cultural data from two different sources, depending on the OS:
- On Unix platforms or Windows 10 and later versions, cultural data is provided by the [International Components for Unicode (ICU) Library](https://icu.unicode.org/). The specific version of the ICU Library depends on the individual operating system.
- On Windows 8.1 and earlier versions, cultural data is provided by the Windows operating system.
Because of this, a culture available on a particular .NET implementation, platform, or version may not be available on a different .NET implementation, platform, or version.
Some `CultureInfo` objects differ depending on the underlying platform. In particular, `zh-CN`, or Chinese (Simplified, China) and `zh-TW`, or Chinese (Traditional, Taiwan), are available cultures on Windows systems, but they are aliased cultures on Unix systems. "zh-CN" is an alias for the "zh-Hans-CN" culture, and "zh-TW" is an alias for the "zh-Hant-TW" culture. Aliased cultures are not returned by calls to the <xref:System.Globalization.CultureInfo.GetCultures*> method and may have different property values, including different <xref:System.Globalization.CultureInfo.Parent> cultures, than their Windows counterparts. For the `zh-CN` and `zh-TW` cultures, these differences include the following:
- On Windows systems, the parent culture of the "zh-CN" culture is "zh-Hans", and the parent culture of the "zh-TW" culture is "zh-Hant". The parent culture of both these cultures is "zh". On Unix systems, the parents of both cultures are "zh". This means that, if you don't provide culture-specific resources for the "zh-CN" or "zh-TW" cultures but do provide a resources for the neutral "zh-Hans" or "zh-Hant" culture, your application will load the resources for the neutral culture on Windows but not on Unix. On Unix systems, you must explicitly set the thread's <xref:System.Globalization.CultureInfo.CurrentUICulture> to either "zh-Hans" or "zh-Hant".
- On Windows systems, calling <xref:System.Globalization.CultureInfo.Equals*?displayProperty=nameWithType> on an instance that represents the "zh-CN" culture and passing it a "zh-Hans-CN" instance returns `true`. On Unix systems, the method call returns `false`. This behavior also applies to calling <xref:System.Globalization.CultureInfo.Equals*> on a "zh-TW" <xref:System.Globalization.CultureInfo> instance and passing it a "zh-Hant-Tw" instance.
## Dynamic culture data
Except for the invariant culture, culture data is dynamic. This is true even for the predefined cultures. For example, countries or regions adopt new currencies, change their spellings of words, or change their preferred calendar, and culture definitions change to track this. Custom cultures are subject to change without notice, and any specific culture might be overridden by a custom replacement culture. Also, as discussed below, an individual user can override cultural preferences. Applications should always obtain culture data at runtime.
> [!CAUTION]
> When saving data, your application should use the invariant culture, a binary format, or a specific culture-independent format. Data saved according to the current values associated with a particular culture, other than the invariant culture, might become unreadable or might change in meaning if that culture changes.
## The current culture and current UI culture
Every thread in a .NET application has a current culture and a current UI culture. The current culture determines the formatting conventions for dates, times, numbers, and currency values, the sort order of text, casing conventions, and the ways in which strings are compared. The current UI culture is used to retrieve culture-specific resources at runtime.
> [!NOTE]
> For information on how the current and current UI culture is determined on a per-thread basis, see the [Culture and threads](#culture-and-threads) section. For information on how the current and current UI culture is determined on threads performing task-based asynchronous operations, see the [Culture and task-based asynchronous operations](#culture-and-task-based-asynchronous-operations) section.
For more detailed information on the current culture, see the <xref:System.Globalization.CultureInfo.CurrentCulture?displayProperty=nameWithType> property. For more detailed information on the current UI culture, see the <xref:System.Globalization.CultureInfo.CurrentUICulture?displayProperty=nameWithType> property topic.
### Retrieve the current and current UI cultures
You can get a <xref:System.Globalization.CultureInfo> object that represents the current culture in either of two ways:
- By retrieving the value of the <xref:System.Globalization.CultureInfo.CurrentCulture?displayProperty=nameWithType> property.
- By retrieving the value of the [Thread.CurrentThread.CurrentCulture](xref:System.Threading.Thread.CurrentCulture) property.
The following example retrieves both property values, compares them to show that they are equal, and displays the name of the current culture.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/Current1.cs" id="Snippet1":::
You can get a <xref:System.Globalization.CultureInfo> object that represents the current UI culture in either of two ways:
- By retrieving the value of the <xref:System.Globalization.CultureInfo.CurrentUICulture?displayProperty=nameWithType> property.
- By retrieving the value of the [Thread.CurrentThread.CurrentUICulture](xref:System.Threading.Thread.CurrentUICulture) property.
The following example retrieves both property values, compares them to show that they are equal, and displays the name of the current UI culture.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/CurrentUI1.cs" id="Snippet2":::
### Set the current and current UI cultures
To change the culture and UI culture of a thread, do the following:
1. Instantiate a <xref:System.Globalization.CultureInfo> object that represents that culture by calling a <xref:System.Globalization.CultureInfo> class constructor and passing it the name of the culture. The <xref:System.Globalization.CultureInfo.%23ctor(System.String)> constructor instantiates a <xref:System.Globalization.CultureInfo> object that reflects user overrides if the new culture is the same as the current Windows culture. The <xref:System.Globalization.CultureInfo.%23ctor(System.String,System.Boolean)> constructor allows you to specify whether the newly instantiated <xref:System.Globalization.CultureInfo> object reflects user overrides if the new culture is the same as the current Windows culture.
2. Assign the <xref:System.Globalization.CultureInfo> object to the <xref:System.Globalization.CultureInfo.CurrentCulture?displayProperty=nameWithType> or <xref:System.Globalization.CultureInfo.CurrentUICulture?displayProperty=nameWithType> property.
The following example retrieves the current culture. If it is anything other than the French (France) culture, it changes the current culture to French (France). Otherwise, it changes the current culture to French (Luxembourg).
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/Change1.cs" id="Snippet3":::
The following example retrieves the current culture. If it is anything other the Slovenian (Slovenia) culture, it changes the current culture to Slovenian (Slovenia). Otherwise, it changes the current culture to Croatian (Croatia).
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/ChangeUI1.cs" id="Snippet4":::
## Get all cultures
You can retrieve an array of specific categories of cultures or of all the cultures available on the local computer by calling the <xref:System.Globalization.CultureInfo.GetCultures*> method. For example, you can retrieve custom cultures, specific cultures, or neutral cultures either alone or in combination.
The following example calls the <xref:System.Globalization.CultureInfo.GetCultures*> method twice, first with the <xref:System.Globalization.CultureTypes?displayProperty=nameWithType> enumeration member to retrieve all custom cultures, and then with the <xref:System.Globalization.CultureTypes?displayProperty=nameWithType> enumeration member to retrieve all replacement cultures.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/GetCultures1.cs" id="Snippet5":::
## Culture and threads
When a new application thread is started, its current culture and current UI culture are defined by the current system culture, and not by the current thread culture. The following example illustrates the difference. It sets the current culture and current UI culture of an application thread to the French (France) culture (fr-FR). If the current culture is already fr-FR, the example sets it to the English (United States) culture (en-US). It displays three random numbers as currency values and then creates a new thread, which, in turn, displays three more random numbers as currency values. But as the output from the example shows, the currency values displayed by the new thread do not reflect the formatting conventions of the French (France) culture, unlike the output from the main application thread.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/defaultthread1.cs" id="Snippet1":::
You can set the culture and UI culture of all threads in an application domain by assigning a <xref:System.Globalization.CultureInfo> object that represents that culture to the <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> properties. The following example uses these properties to ensure that all threads in the default application domain share the same culture.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/setthreads1.cs" id="Snippet3":::
When you assign values to the <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> properties, the culture and UI culture of the threads in the application domain also change if they have not explicitly been assigned a culture. However, these threads reflect the new culture settings only while they execute in the current application domain. If these threads execute in another application domain, their culture becomes the default culture defined for that application domain. As a result, we recommend that you always set the culture of the main application thread, and not rely on the <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> properties to change it.
## Culture and task-based asynchronous operations
The [task-based asynchronous programming pattern](/dotnet/standard/parallel-programming/task-based-asynchronous-programming) uses <xref:System.Threading.Tasks.Task> and <xref:System.Threading.Tasks.Task`1> objects to asynchronously execute delegates on thread pool threads. The specific thread on which a particular task runs is not known in advance, but is determined only at runtime.
Culture is part of an asynchronous operation's context. In other words, asynchronous operations by default inherit the values of the <xref:System.Globalization.CultureInfo.CurrentCulture> and <xref:System.Globalization.CultureInfo.CurrentUICulture> properties of the thread from which they are launched. If the current culture or current UI culture differs from the system culture, the current culture crosses thread boundaries and becomes the current culture of the thread pool thread that is executing an asynchronous operation.
The following example provides a simple illustration. The example defines a <xref:System.Func`1> delegate, `formatDelegate`, that returns some numbers formatted as currency values. The example changes the current system culture to either French (France) or, if French (France) is already the current culture, English (United States). It then:
- Invokes the delegate directly so that it runs synchronously on the main app thread.
- Creates a task that executes the delegate asynchronously on a thread pool thread.
- Creates a task that executes the delegate synchronously on the main app thread by calling the <xref:System.Threading.Tasks.Task.RunSynchronously*?displayProperty=nameWithType> method.
As the output from the example shows, when the current culture is changed to French (France), the current culture of the thread from which tasks are invoked asynchronously becomes the current culture for that asynchronous operation.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/asyncculture1.cs" id="Snippet1":::
## CultureInfo object serialization
When a <xref:System.Globalization.CultureInfo> object is serialized, all that is actually stored is <xref:System.Globalization.CultureInfo.Name> and <xref:System.Globalization.CultureInfo.UseUserOverride*>. It is successfully deserialized only in an environment where that <xref:System.Globalization.CultureInfo.Name> has the same meaning. The following three examples show why this is not always the case:
- If the <xref:System.Globalization.CultureInfo.CultureTypes> property value is <xref:System.Globalization.CultureTypes.InstalledWin32Cultures?displayProperty=nameWithType>, and if that culture was first introduced in a particular version of the Windows operating system, it is not possible to deserialize it on an earlier version of Windows. For example, if a culture was introduced in Windows 10, it cannot be deserialized on Windows 8.
- If the <xref:System.Globalization.CultureInfo.CultureTypes> value is <xref:System.Globalization.CultureTypes.UserCustomCulture?displayProperty=nameWithType>, and the computer on which it is deserialized does not have this user custom culture installed, it is not possible to deserialize it.
- If the <xref:System.Globalization.CultureInfo.CultureTypes> value is <xref:System.Globalization.CultureTypes.ReplacementCultures?displayProperty=nameWithType>, and the computer on which it is deserialized does not have this replacement culture, it deserializes to the same name, but not all of the same characteristics. For example, if `en-US` is a replacement culture on computer A, but not on computer B, and if a <xref:System.Globalization.CultureInfo> object referring to this culture is serialized on computer A and deserialized on computer B, then none of the custom characteristics of the culture are transmitted. The culture deserializes successfully, but with a different meaning.
## Control Panel overrides
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. In general, your applications should honor these user overrides.
If <xref:System.Globalization.CultureInfo.UseUserOverride*> is `true` and the specified culture matches the current culture of Windows, the <xref:System.Globalization.CultureInfo> uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars>, the results of the methods and the values of the properties are undefined.
## Alternate sort orders
Some cultures support more than one sort order. For example:
- The Spanish (Spain) culture has two sort orders: the default international sort order, and the traditional sort order. When you instantiate a <xref:System.Globalization.CultureInfo> object with the `es-ES` culture name, the international sort order is used. When you instantiate a <xref:System.Globalization.CultureInfo> object with the `es-ES-tradnl` culture name, the traditional sort order is used.
- The `zh-CN` (Chinese (Simplified, PRC)) culture supports two sort orders: by pronunciation (the default) and by stroke count. When you instantiate a <xref:System.Globalization.CultureInfo> object with the `zh-CN` culture name, the default sort order is used. When you instantiate a <xref:System.Globalization.CultureInfo> object with a local identifier of 0x00020804, strings are sorted by stroke count.
The following table lists the cultures that support alternate sort orders and the identifiers for the default and alternate sort orders.
| Culture name | Culture | Default sort name and identifier | Alternate sort name and identifier |
|--------------|-------------------------|----------------------------------|---------------------------------------|
| es-ES | Spanish (Spain) | International: 0x00000C0A | Traditional: 0x0000040A |
| zh-TW | Chinese (Taiwan) | Stroke Count: 0x00000404 | Bopomofo: 0x00030404 |
| zh-CN | Chinese (PRC) | Pronunciation: 0x00000804 | Stroke Count: 0x00020804 |
| zh-HK | Chinese (Hong Kong SAR) | Stroke Count: 0x00000c04 | Stroke Count: 0x00020c04 |
| zh-SG | Chinese (Singapore) | Pronunciation: 0x00001004 | Stroke Count: 0x00021004 |
| zh-MO | Chinese (Macao SAR) | Pronunciation: 0x00001404 | Stroke Count: 0x00021404 |
| ja-JP | Japanese (Japan) | Default: 0x00000411 | Unicode: 0x00010411 |
| ko-KR | Korean (Korea) | Default: 0x00000412 | Korean Xwansung - Unicode: 0x00010412 |
| de-DE | German (Germany) | Dictionary: 0x00000407 | Phone Book Sort DIN: 0x00010407 |
| hu-HU | Hungarian (Hungary) | Default: 0x0000040e | Technical Sort: 0x0001040e |
| ka-GE | Georgian (Georgia) | Traditional: 0x00000437 | Modern Sort: 0x00010437 |
## Example
The following example shows how to create a <xref:System.Globalization.CultureInfo> object for Spanish (Spain) with the international sort and another <xref:System.Globalization.CultureInfo> object with the traditional sort.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/spanishspain.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Globalization/CultureInfo/Overview/spanishspain.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Globalization.RegionInfo" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Globalization.CultureInfo" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CultureInfo (int culture);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(int32 culture) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.#ctor(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (culture As Integer)" />
<MemberSignature Language="F#" Value="new System.Globalization.CultureInfo : int -> System.Globalization.CultureInfo" Usage="new System.Globalization.CultureInfo culture" />
<MemberSignature Language="C++ CLI" Value="public:
 CultureInfo(int culture);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
</AssemblyInfo>
<Parameters>
<Parameter Name="culture" Type="System.Int32" Index="0" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
</Parameters>
<Docs>
<param name="culture">A predefined <see cref="T:System.Globalization.CultureInfo" /> identifier, <see cref="P:System.Globalization.CultureInfo.LCID" /> property of an existing <see cref="T:System.Globalization.CultureInfo" /> object, or Windows-only culture identifier.</param>
<summary>Initializes a new instance of the <see cref="T:System.Globalization.CultureInfo" /> class based on the culture specified by the culture identifier.</summary>
<remarks>
<format type="text/markdown"><. Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47).
In most cases, the `culture` parameter is mapped to the corresponding National Language Support (NLS) locale identifier. The value of the `culture` parameter becomes the value of the <xref:System.Globalization.CultureInfo.LCID> property of the new <xref:System.Globalization.CultureInfo>.
We recommend that you call the locale name constructor <xref:System.Globalization.CultureInfo.%23ctor*?displayProperty=nameWithType>, because locale names are preferable to LCIDs. For custom locales, a locale name is required.
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the specified culture identifier matches the culture identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> that uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo> (for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>) the results of the methods and the values of the properties are undefined.
If the specified culture identifier does not match the identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> that uses the default values for the specified culture.
The <xref:System.Globalization.CultureInfo.UseUserOverride> property is always set to `true`.
For example, suppose that Arabic (Saudi Arabia) is the current Windows culture and the user has changed the calendar from Hijri to Gregorian.
- With `CultureInfo("0x0401")` (culture name ar-SA), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.GregorianCalendar> (which is the user setting) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("0x041E")` (culture name th-TH), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
> [!NOTE]
> For backwards compatibility, a culture constructed using a `culture` parameter of 0x0004 or 0x7c04 has a <xref:System.Globalization.CultureInfo.Name> property of `zh-CHS` or `zh-CHT`, respectively. You should instead prefer to construct the culture using the current standard culture names of `zh-Hans` or `zh-Hant`, unless you have a reason for using the older names.
> [!NOTE]
> LCIDs are being deprecated, and implementers are strongly encouraged to use newer versions of APIs that support BCP 47 locale names instead. Each LCID can be represented by a BCP 47 locale name, but the reverse is not true. The LCID range is restricted and unable to uniquely identify all the possible combinations of language and region.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="culture" /> is less than zero.</exception>
<exception cref="T:System.Globalization.CultureNotFoundException">
<paramref name="culture" /> is not a valid culture identifier. See the Notes to Callers section for more information.</exception>
<block subset="none" type="usage">
<para>This method attempts to retrieve a <see cref="T:System.Globalization.CultureInfo" /> object whose identifier is <paramref name="culture" /> from the operating system; if the operating system does not support that culture, the method throws a <see cref="T:System.Globalization.CultureNotFoundException" /> exception.</para>
<para>A <see cref="T:System.Globalization.CultureNotFoundException" /> is also thrown if the app is running in an environment where globalization-invariant mode is enabled, for example, some Docker containers, and a culture other than the invariant culture is specified.</para>
</block>
<altmember cref="P:System.Globalization.CultureInfo.LCID" />
<altmember cref="P:System.Globalization.CultureInfo.UseUserOverride" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CultureInfo (string name);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (name As String)" />
<MemberSignature Language="F#" Value="new System.Globalization.CultureInfo : string -> System.Globalization.CultureInfo" Usage="new System.Globalization.CultureInfo name" />
<MemberSignature Language="C++ CLI" Value="public:
 CultureInfo(System::String ^ name);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="name" Type="System.String" />
</Parameters>
<Docs>
<param name="name">A predefined <see cref="T:System.Globalization.CultureInfo" /> name, <see cref="P:System.Globalization.CultureInfo.Name" /> of an existing <see cref="T:System.Globalization.CultureInfo" />, or Windows-only culture name. <paramref name="name" /> is not case-sensitive.</param>
<summary>Initializes a new instance of the <see cref="T:System.Globalization.CultureInfo" /> class based on the culture specified by name.</summary>
<remarks>
<format type="text/markdown"><. Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47). In addition, starting with Windows 10, `name` can be any valid BCP-47 language tag.
If `name` is <xref:System.String.Empty?displayProperty=nameWithType>, the constructor creates an instance of the invariant culture; this is equivalent to retrieving the value of the <xref:System.Globalization.CultureInfo.InvariantCulture> property.
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the culture identifier associated with `name` matches the culture identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> object that uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>, the results of the methods and the values of the properties are undefined.
If the culture identifier associated with `name` does not match the culture identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> object that uses the default values for the specified culture.
The <xref:System.Globalization.CultureInfo.UseUserOverride> property is always set to `true`.
For example, suppose that Arabic (Saudi Arabia) is the current culture of Windows and the user changed the calendar from Hijri to Gregorian:
- With `CultureInfo("ar-SA")`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.GregorianCalendar> (which is the user setting) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("th-TH")`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
The <xref:System.Globalization.CultureInfo.LCID> property of the new <xref:System.Globalization.CultureInfo> is set to the culture identifier associated with the specified name.
## Examples
The following example retrieves the current culture. If it is anything other than the French (France) culture, it calls the <xref:System.Globalization.CultureInfo.%23ctor(System.String)> constructor to instantiate a <xref:System.Globalization.CultureInfo> object that represents the French (France) culture and makes it the current culture. Otherwise, it instantiates a <xref:System.Globalization.CultureInfo> object that represents the French (Luxembourg) culture and makes it the current culture.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/Change1.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/System.Globalization/CultureInfo/.ctor/Change1.vb" id="Snippet3":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="name" /> is null.</exception>
<exception cref="T:System.Globalization.CultureNotFoundException">
<paramref name="name" /> is not a valid culture name. For more information, see the Notes to Callers section.</exception>
<block subset="none" type="usage">
<para>This method attempts to retrieve a <see cref="T:System.Globalization.CultureInfo" /> object whose identifier is <paramref name="name" /> from the operating system; if the operating system does not support that culture, and if <paramref name="name" /> is not the name of a supplementary or replacement culture, the method throws a <see cref="T:System.Globalization.CultureNotFoundException" /> exception.</para>
<para>A <see cref="T:System.Globalization.CultureNotFoundException" /> is also thrown if the app is running in an environment where globalization-invariant mode is enabled, for example, some Docker containers, and a culture other than the invariant culture is specified.</para>
</block>
<altmember cref="P:System.Globalization.CultureInfo.LCID" />
<altmember cref="P:System.Globalization.CultureInfo.UseUserOverride" />
<altmember cref="M:System.Globalization.CultureInfo.CreateSpecificCulture(System.String)" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CultureInfo (int culture, bool useUserOverride);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(int32 culture, bool useUserOverride) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.#ctor(System.Int32,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (culture As Integer, useUserOverride As Boolean)" />
<MemberSignature Language="F#" Value="new System.Globalization.CultureInfo : int * bool -> System.Globalization.CultureInfo" Usage="new System.Globalization.CultureInfo (culture, useUserOverride)" />
<MemberSignature Language="C++ CLI" Value="public:
 CultureInfo(int culture, bool useUserOverride);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
</AssemblyInfo>
<Parameters>
<Parameter Name="culture" Type="System.Int32" Index="0" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<Parameter Name="useUserOverride" Type="System.Boolean" Index="1" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
</Parameters>
<Docs>
<param name="culture">A predefined <see cref="T:System.Globalization.CultureInfo" /> identifier, <see cref="P:System.Globalization.CultureInfo.LCID" /> property of an existing <see cref="T:System.Globalization.CultureInfo" /> object, or Windows-only culture identifier.</param>
<param name="useUserOverride">
<see langword="true" /> to use the user-selected culture settings (Windows only); <see langword="false" /> to use the default culture settings.</param>
<summary>Initializes a new instance of the <see cref="T:System.Globalization.CultureInfo" /> class based on the culture specified by the culture identifier and on a value that specifies whether to use the user-selected culture settings from Windows.</summary>
<remarks>
<format type="text/markdown"><. Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47).
In most cases, the `culture` parameter is mapped to the corresponding National Language Support (NLS) locale identifier. The value of the `culture` parameter becomes the value of the <xref:System.Globalization.CultureInfo.LCID> property of the new <xref:System.Globalization.CultureInfo>.
We recommend that you call the locale name constructor <xref:System.Globalization.CultureInfo.%23ctor*?displayProperty=nameWithType>, because locale names are preferable to LCIDs. For custom locales, a locale name is required.
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture.
Applications should typically not disallow user overrides. Disallowing overrides does not itself guarantee data stability. For more information, see the blog entry [Culture data shouldn't be considered stable (except for Invariant)](/archive/blogs/shawnste/culture-data-shouldnt-be-considered-stable-except-for-invariant).
If the <xref:System.Globalization.CultureInfo.UseUserOverride> property is set to `true` and the specified culture identifier matches the identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> that uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>, the results of the methods and the values of the properties are undefined.
Otherwise, this constructor creates a <xref:System.Globalization.CultureInfo> that uses the default values for the specified culture.
The value of the `useUserOverride` parameter becomes the value of the <xref:System.Globalization.CultureInfo.UseUserOverride> property.
For example, suppose that Arabic (Saudi Arabia) is the current culture of Windows and the user has changed the calendar from Hijri to Gregorian.
- With `CultureInfo("0x0401", true)` (culture name ar-SA), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.GregorianCalendar> (which is the user setting) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("0x0401", false)` (culture name ar-SA), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.HijriCalendar> (which is the default calendar for ar-SA) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `false`.
- With `CultureInfo("0x041E", true)` (culture name th-TH), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("0x041E", false)` (culture name th-TH), <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `false`.
> [!NOTE]
> For backwards compatibility, a culture constructed using a `culture` parameter of 0x0004 or 0x7c04 will have a <xref:System.Globalization.CultureInfo.Name> property of zh-CHS or zh-CHT, respectively. You should instead prefer to construct the culture using the current standard culture names of `zh-Hans` or zh-Hant, unless you have a reason for using the older names.
> [!NOTE]
> LCIDs are being deprecated, and implementers are strongly encouraged to use newer versions of APIs that support BCP 47 locale names instead. Each LCID can be represented by a BCP 47 locale name, but the reverse is not true. The LCID range is restricted and unable to uniquely identify all the possible combinations of language and region.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="culture" /> is less than zero.</exception>
<exception cref="T:System.Globalization.CultureNotFoundException">
<paramref name="culture" /> is not a valid culture identifier. See the Notes to Callers section for more information.</exception>
<block subset="none" type="usage">
<para>This method attempts to retrieve a <see cref="T:System.Globalization.CultureInfo" /> object whose identifier is <paramref name="culture" /> from the operating system; if the operating system does not support that culture, the method throws a <see cref="T:System.Globalization.CultureNotFoundException" /> exception.</para>
<para>A <see cref="T:System.Globalization.CultureNotFoundException" /> is also thrown if the app is running in an environment where globalization-invariant mode is enabled, for example, some Docker containers, and a culture other than the invariant culture is specified.</para>
</block>
<altmember cref="P:System.Globalization.CultureInfo.LCID" />
<altmember cref="P:System.Globalization.CultureInfo.UseUserOverride" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CultureInfo (string name, bool useUserOverride);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name, bool useUserOverride) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.#ctor(System.String,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (name As String, useUserOverride As Boolean)" />
<MemberSignature Language="F#" Value="new System.Globalization.CultureInfo : string * bool -> System.Globalization.CultureInfo" Usage="new System.Globalization.CultureInfo (name, useUserOverride)" />
<MemberSignature Language="C++ CLI" Value="public:
 CultureInfo(System::String ^ name, bool useUserOverride);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
</AssemblyInfo>
<Parameters>
<Parameter Name="name" Type="System.String" Index="0" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
<Parameter Name="useUserOverride" Type="System.Boolean" Index="1" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
</Parameters>
<Docs>
<param name="name">A predefined <see cref="T:System.Globalization.CultureInfo" /> name, <see cref="P:System.Globalization.CultureInfo.Name" /> of an existing <see cref="T:System.Globalization.CultureInfo" />, or Windows-only culture name. <paramref name="name" /> is not case-sensitive.</param>
<param name="useUserOverride">
<see langword="true" /> to use the user-selected culture settings (Windows only); <see langword="false" /> to use the default culture settings.</param>
<summary>Initializes a new instance of the <see cref="T:System.Globalization.CultureInfo" /> class based on the culture specified by name and on a value that specifies whether to use the user-selected culture settings from Windows.</summary>
<remarks>
<format type="text/markdown"><. Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47). In addition, starting with Windows 10, `name` can be any valid BCP-47 language tag.
If `name` is <xref:System.String.Empty?displayProperty=nameWithType>, the constructor creates an instance of the invariant culture; this is equivalent to retrieving the value of the <xref:System.Globalization.CultureInfo.InvariantCulture> property.
The user might choose to override some of the values associated with the current Windows culture through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture.
Applications should typically not disallow user overrides. Disallowing overrides does not itself guarantee data stability. For more information, see the blog entry [Culture data shouldn't be considered stable (except for Invariant)](/archive/blogs/shawnste/culture-data-shouldnt-be-considered-stable-except-for-invariant).
If the <xref:System.Globalization.CultureInfo.UseUserOverride> property is set to `true` and the culture identifier associated with the specified culture name matches the culture identifier of the current Windows culture, this constructor creates a <xref:System.Globalization.CultureInfo> that uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>, the results of the methods and the values of the properties are undefined.
Otherwise, this constructor creates a <xref:System.Globalization.CultureInfo> that uses the default values for the specified culture.
The value of the `useUserOverride` parameter becomes the value of the <xref:System.Globalization.CultureInfo.UseUserOverride> property.
For example, suppose that Arabic (Saudi Arabia) is the current culture of Windows and the user changed the calendar from Hijri to Gregorian.
- With `CultureInfo("ar-SA", true)`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.GregorianCalendar> (which is the user setting) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("ar-SA", false)`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.HijriCalendar> (which is the default calendar for ar-SA) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `false`.
- With `CultureInfo("th-TH", true)`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `true`.
- With `CultureInfo("th-TH", false)`, <xref:System.Globalization.CultureInfo.Calendar*> is set to <xref:System.Globalization.ThaiBuddhistCalendar> (which is the default calendar for th-TH) and <xref:System.Globalization.CultureInfo.UseUserOverride*> is set to `false`.
The <xref:System.Globalization.CultureInfo.LCID> property of the new <xref:System.Globalization.CultureInfo> is set to the culture identifier associated with the specified name.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="name" /> is null.</exception>
<exception cref="T:System.Globalization.CultureNotFoundException">
<paramref name="name" /> is not a valid culture name. See the Notes to Callers section for more information.</exception>
<block subset="none" type="usage">
<para>This method attempts to retrieve a <see cref="T:System.Globalization.CultureInfo" /> object whose identifier is <paramref name="name" /> from the operating system; if the operating system does not support that culture, and if <paramref name="name" /> is not the name of a supplementary or replacement culture, the method throws a <see cref="T:System.Globalization.CultureNotFoundException" /> exception.</para>
<para>A <see cref="T:System.Globalization.CultureNotFoundException" /> is also thrown if the app is running in an environment where globalization-invariant mode is enabled, for example, some Docker containers, and a culture other than the invariant culture is specified.</para>
</block>
<altmember cref="P:System.Globalization.CultureInfo.LCID" />
<altmember cref="P:System.Globalization.CultureInfo.UseUserOverride" />
<altmember cref="M:System.Globalization.CultureInfo.CreateSpecificCulture(System.String)" />
</Docs>
</Member>
<Member MemberName="Calendar">
<MemberSignature Language="C#" Value="public virtual System.Globalization.Calendar Calendar { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Globalization.Calendar Calendar" />
<MemberSignature Language="DocId" Value="P:System.Globalization.CultureInfo.Calendar" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property Calendar As Calendar" />
<MemberSignature Language="F#" Value="member this.Calendar : System.Globalization.Calendar" Usage="System.Globalization.CultureInfo.Calendar" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property System::Globalization::Calendar ^ Calendar { System::Globalization::Calendar ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.Calendar</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the default calendar used by the culture.</summary>
<value>A <see cref="T:System.Globalization.Calendar" /> that represents the default calendar used by the culture.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture.
If <xref:System.Globalization.CultureInfo.UseUserOverride*> is `true` and the specified culture matches the current culture of Windows, the <xref:System.Globalization.CultureInfo> uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>, the results of the methods and the values of the properties are undefined.
Therefore, if <xref:System.Globalization.CultureInfo.UseUserOverride*> is `true`, the value of this property might be different from the default calendar used by the culture.
Your application changes the calendar used by the current <xref:System.Globalization.CultureInfo> by setting the <xref:System.Globalization.DateTimeFormatInfo.Calendar> property of <xref:System.Globalization.CultureInfo.DateTimeFormat*>, which is an instance of the <xref:System.Globalization.DateTimeFormatInfo> class. The new calendar must be one of the calendars listed in <xref:System.Globalization.CultureInfo.OptionalCalendars*>. <xref:System.Globalization.CultureInfo.DateTimeFormat*> also includes other properties that customize the date and time formatting associated with that <xref:System.Globalization.DateTimeFormatInfo.Calendar*>.
]]></format>
</remarks>
<altmember cref="T:System.Globalization.Calendar" />
<altmember cref="P:System.Globalization.CultureInfo.DateTimeFormat" />
<altmember cref="T:System.Globalization.DateTimeFormatInfo" />
</Docs>
</Member>
<Member MemberName="ClearCachedData">
<MemberSignature Language="C#" Value="public void ClearCachedData ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ClearCachedData() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.ClearCachedData" />
<MemberSignature Language="VB.NET" Value="Public Sub ClearCachedData ()" />
<MemberSignature Language="F#" Value="member this.ClearCachedData : unit -> unit" Usage="cultureInfo.ClearCachedData " />
<MemberSignature Language="C++ CLI" Value="public:
 void ClearCachedData();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Refreshes cached culture-related information.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Information, such as the default culture and format patterns, is cached the first time it's requested. That information can change, for example, when the user modifies the regional and language options portion of Control Panel. However, the <xref:System.Globalization.CultureInfo> class does not automatically detect changes in the system settings.
The <xref:System.Globalization.CultureInfo.ClearCachedData*> method clears the cache of <xref:System.Globalization.CultureInfo> objects created by <xref:System.Globalization.CultureInfo.GetCultureInfo*> and refreshes the information in the <xref:System.Globalization.CultureInfo.CurrentCulture*>, <xref:System.Globalization.CultureInfo.CurrentUICulture*>, and <xref:System.Globalization.RegionInfo.CurrentRegion*> properties, based on the current system settings.
The <xref:System.Globalization.CultureInfo.ClearCachedData*> method does not refresh the information in the <xref:System.Threading.Thread.CurrentCulture?displayProperty=nameWithType> property for existing threads. However, future threads will have any new <xref:System.Globalization.CultureInfo> property values.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Clone">
<MemberSignature Language="C#" Value="public virtual object Clone ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance object Clone() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.Clone" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function Clone () As Object" />
<MemberSignature Language="F#" Value="abstract member Clone : unit -> obj
override this.Clone : unit -> obj" Usage="cultureInfo.Clone " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Object ^ Clone();" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1">M:System.ICloneable.Clone</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a copy of the current <see cref="T:System.Globalization.CultureInfo" />.</summary>
<returns>A copy of the current <see cref="T:System.Globalization.CultureInfo" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The clone is writable even if the original <xref:System.Globalization.CultureInfo> is read-only. Therefore, the properties of the clone can be modified.
A shallow copy of an object is a copy of the object only. If the object contains references to other objects, the shallow copy does not create copies of the referred objects. It refers to the original objects instead. In contrast, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.
The <xref:System.Globalization.CultureInfo.Clone*> method creates an enhanced shallow copy. The objects returned by the <xref:System.Globalization.CultureInfo.NumberFormat*>, <xref:System.Globalization.CultureInfo.DateTimeFormat*>, <xref:System.Globalization.CultureInfo.TextInfo*>, and <xref:System.Globalization.CultureInfo.Calendar*> properties are also copied. Consequently, the cloned <xref:System.Globalization.CultureInfo> object can modify its copied properties without affecting the original <xref:System.Globalization.CultureInfo> object.
## Examples
The following code example shows that CultureInfo.Clone also clones the <xref:System.Globalization.DateTimeFormatInfo> and <xref:System.Globalization.NumberFormatInfo> instances associated with the <xref:System.Globalization.CultureInfo>.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Clone/yslin_cultureinfo_clone.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Globalization/CultureInfo/Clone/yslin_cultureinfo_clone.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Object" />
</Docs>
</Member>
<Member MemberName="CompareInfo">
<MemberSignature Language="C#" Value="public virtual System.Globalization.CompareInfo CompareInfo { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Globalization.CompareInfo CompareInfo" />
<MemberSignature Language="DocId" Value="P:System.Globalization.CultureInfo.CompareInfo" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property CompareInfo As CompareInfo" />
<MemberSignature Language="F#" Value="member this.CompareInfo : System.Globalization.CompareInfo" Usage="System.Globalization.CultureInfo.CompareInfo" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property System::Globalization::CompareInfo ^ CompareInfo { System::Globalization::CompareInfo ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.CompareInfo</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Globalization.CompareInfo" /> that defines how to compare strings for the culture.</summary>
<value>The <see cref="T:System.Globalization.CompareInfo" /> that defines how to compare strings for the culture.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Globalization.CultureInfo.CompareInfo> property returns a <xref:System.Globalization.CompareInfo> object that provides culture-specific information used in culture-sensitive sorting and string comparison operations.
The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture.
If <xref:System.Globalization.CultureInfo.UseUserOverride*> is `true` and the specified culture matches the current culture of Windows, the <xref:System.Globalization.CultureInfo> uses those overrides, including user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property, and the properties of the <xref:System.Globalization.NumberFormatInfo> instance returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. If the user settings are incompatible with the culture associated with the <xref:System.Globalization.CultureInfo>, for example, if the selected calendar is not one of the <xref:System.Globalization.CultureInfo.OptionalCalendars*>, the results of the methods and the values of the properties are undefined.
## Examples
The following code example shows how to create a <xref:System.Globalization.CultureInfo> for Spanish (Spain) with the international sort and another <xref:System.Globalization.CultureInfo> with the traditional sort.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/Overview/spanishspain.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/System.Globalization/CultureInfo/Overview/spanishspain.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Globalization.CompareInfo" />
</Docs>
</Member>
<Member MemberName="CreateSpecificCulture">
<MemberSignature Language="C#" Value="public static System.Globalization.CultureInfo CreateSpecificCulture (string name);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Globalization.CultureInfo CreateSpecificCulture(string name) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Globalization.CultureInfo.CreateSpecificCulture(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function CreateSpecificCulture (name As String) As CultureInfo" />
<MemberSignature Language="F#" Value="static member CreateSpecificCulture : string -> System.Globalization.CultureInfo" Usage="System.Globalization.CultureInfo.CreateSpecificCulture name" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Globalization::CultureInfo ^ CreateSpecificCulture(System::String ^ name);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Globalization</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.CultureInfo</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" Index="0" FrameworkAlternate="net-10.0;net-11.0;net-5.0;net-6.0;net-7.0;net-8.0;net-9.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1" />
</Parameters>
<Docs>
<param name="name">A predefined <see cref="T:System.Globalization.CultureInfo" /> name or the name of an existing <see cref="T:System.Globalization.CultureInfo" /> object. <paramref name="name" /> is not case-sensitive.</param>
<summary>Creates a <see cref="T:System.Globalization.CultureInfo" /> that represents the specific culture that is associated with the specified name.</summary>
<returns>A <see cref="T:System.Globalization.CultureInfo" /> object that represents:
The invariant culture, if <paramref name="name" /> is an empty string ("").
-or-
The specific culture associated with <paramref name="name" />, if <paramref name="name" /> is a neutral culture.
-or-
The culture specified by <paramref name="name" />, if <paramref name="name" /> is already a specific culture.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Globalization.CultureInfo.CreateSpecificCulture*> method wraps a call to the <xref:System.Globalization.CultureInfo.%23ctor(System.String)> constructor.
> [!NOTE]
> For a list of predefined culture names on Windows systems, see the **Language tag** column in the [list of language/region names supported by Windows](https://learn.microsoft.com/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c). Culture names follow the standard defined by [BCP 47](https://tools.ietf.org/html/bcp47). In addition, starting with Windows 10, `name` can be any valid BCP-47 language tag.
Cultures are grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures. For more information, see the description of the <xref:System.Globalization.CultureInfo> class.
If the culture identifier of the specific culture returned by this method matches the culture identifier of the current Windows culture, this method creates a <xref:System.Globalization.CultureInfo> object that uses the Windows culture overrides. The overrides include user settings for the properties of the <xref:System.Globalization.DateTimeFormatInfo> object returned by the <xref:System.Globalization.CultureInfo.DateTimeFormat> property and the <xref:System.Globalization.NumberFormatInfo> object returned by the <xref:System.Globalization.CultureInfo.NumberFormat> property. To instantiate a <xref:System.Globalization.CultureInfo> object that with default culture settings rather than user overrides, call the <xref:System.Globalization.CultureInfo.%23ctor(System.String,System.Boolean)> constructor with a value of `false` for the `useUserOverride` argument.
Although the <xref:System.Globalization.CultureInfo.CreateSpecificCulture*> method name includes the term "Specific", remember that culture data can change between versions, or due to custom cultures, or because of user overrides. Use the invariant culture or binary or fixed forms for saving data.
## Examples
The following example retrieves an array of <xref:System.Globalization.CultureInfo> objects that represent neutral cultures from the <xref:System.Globalization.CultureInfo.GetCultures*> method and sorts the array. When it iterates the elements in the array, it passes the name of each neutral culture to the <xref:System.Globalization.CultureInfo.CreateSpecificCulture*> method and displays the name of the specific culture returned by the method.
> [!NOTE]
> The example uses the `zh-CHS` and `zh-CHT` culture names. However, applications that target Windows Vista and later should use `zh-Hans` instead of `zh-CHS` and `zh-Hant` instead of zh-CHT. `zh-Hans` and `zh-Hant` represent the current standard and should be used unless you have a reason for using the older names.
>
> Note also that the results of the example may differ on an installation of Taiwanese Windows, where the input of a Chinese (Traditional) neutral culture (zh, zh-CHT, or zh-Hant) will return zh-TW.
:::code language="csharp" source="~/snippets/csharp/System.Globalization/CultureInfo/CreateSpecificCulture/createspecificculture2.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/System.Globalization/CultureInfo/CreateSpecificCulture/createspecificculture2.vb" id="Snippet2":::
]]></format>
</remarks>
<exception cref="T:System.Globalization.CultureNotFoundException">
<paramref name="name" /> is not a valid culture name.