Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of CultureInfo.GetCultureInfo?

What is the equivalent of CultureInfo.GetCultureInfo() in ASP.NET 5 (vNext)? When compiling against ASP.NET Core 5.0 and trying to call that method, I get the following error:

ASP.NET Core 5.0 error CS0117: 'CultureInfo' does not contain a definition for 'GetCultureInfo'

like image 400
Chris Montgomery Avatar asked Jan 28 '15 21:01

Chris Montgomery


People also ask

What is System globalization CultureInfo?

The CultureInfo class specifies a unique name for each culture, based on RFC 4646. The name is a combination of an ISO 639 two-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 target .

What is System globalization CultureInfo Invariantculture?

The invariant culture is culture-insensitive; it is associated with the English language but not with any country/region. You specify the invariant culture by name by using an empty string ("") in the call to a CultureInfo instantiation method. CultureInfo.

What is CultureInfo CurrentCulture?

The CultureInfo. CurrentCulture property is a per-thread setting; that is, each thread can have its own culture. You get the culture of the current thread by retrieving the value of the CultureInfo. CurrentCulture property, as the following example illustrates. C# Copy.

What does the Getcultures method of the CultureInfo class do?

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.


1 Answers

For ASP.NET Core 1.0 RC2 and RTM use constructor parameter:

var ruCulture = new CultureInfo("ru-RU");
like image 119
Dmitry Avatar answered Sep 20 '22 03:09

Dmitry