Tell me the difference between CultureInfo.CurrentCulture and CultureInfo.InvariantCulture

Posted by Prabu_Spark under ASP.NET on 1/29/2013 | Points: 10 | Views : 3116 | Status : [Member] | Replies : 1
Hi sir,
Tell me the difference between CultureInfo.CurrentCulture and CultureInfo.InvariantCulture in c#. Kindly give me solution with examples.

With regards,


Posted by: San.Pblr.Gct on: 1/29/2013 [Member] Starter | Points: 25

Current Culture uses the culture from where the application is can be of any languages like German, french. But if its invariant culture its always English. it is not associated with any region or country.

Check the below definition from msdn

public static CultureInfo InvariantCulture { get; }

Property Value
The CultureInfo that is culture-independent (invariant).

The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string ("") or by its culture identifier 0x007F. InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture.
and :


public static CultureInfo CurrentCulture { get; }
Property Value
The CultureInfo that represents the culture used by the current thread.

The culture is a property of the executing thread. This read-only property returns Thread.CurrentCulture. When a thread is started, its culture is initially determined by using GetUserDefaultLCID from the Windows API. To change the culture used by a thread, set Thread.CurrentCulture to the new culture. Changing the culture of Thread.CurrentThread requires a SecurityPermission with the ControlThread flag set. Manipulating threads is dangerous because of the security state associated with threads. Therefore, this permission should be given only to trustworthy code, and then only as necessary. You cannot change a thread's culture in semi-trusted code.

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response