CulturInfo not working as expected in C#

I have started working with Globalization and Localization functionality for a system I am building. I could not understand why, when I wanted to get the intellisense for the class that nothing showed up. After some time I decided to use the full name of the class to get to the methods like this:

[sourcecode language="csharp" padlinenumbers="true"]
System.Globalization.CultureInfo
System.Globalization.RegionInfo
[/sourcecode]

I did this instead of what I normally do, being to include the using System.Globalization and accessing the classes directly.

The root cause of my problem however, turned out to be that I named my namespace CultureInfo. We need to be careful that we never name anything the same as what already exists in the .Net Framework or anywhere else for that matter.

Seems like common sense, but it just happened and cost about an hour…




Leave a Comment

Your email address will not be published.