Norway has two official native names in its two official written standards; Norge in Bokmål and Noreg in Nynorsk.
When initializing a new RegionInfo with a Norwegian country code it will have a different value for its NativeName property depending solely on whether you capitalized the country code or not.
The official documentation for the RegionInfo(string) constructor specifies that case is not significant.
What's even worse is that depending on which capitalization you use the first time you initialize a RegionInfo instance the results will be cached and be returned on subsequent initializations of instances regardless of capitalization.
Quick sample code that demonstrates the issue:
using System;
using System.Globalization;
namespace ConsoleApp1
{
public static class Program
{
public static void Main(string[] args)
{
Console.WriteLine(new RegionInfo("NO").NativeName);
Console.WriteLine(new RegionInfo("no").NativeName);
}
}
}
If we change the order we initialize the instances, we get a completely different output:
using System;
using System.Globalization;
namespace ConsoleApp1
{
public static class Program
{
public static void Main(string[] args)
{
Console.WriteLine(new RegionInfo("no").NativeName);
Console.WriteLine(new RegionInfo("NO").NativeName);
}
}
}
It is expected that both capitalizations of the country code should return the same NativeName regardless of which is used first.
.NET Core version: 3.1.302
OS: Windows 10, version 2004, build 19041.388
Norway has two official native names in its two official written standards; Norge in Bokmål and Noreg in Nynorsk.
When initializing a new
RegionInfowith a Norwegian country code it will have a different value for itsNativeNameproperty depending solely on whether you capitalized the country code or not.The official documentation for the
RegionInfo(string)constructor specifies that case is not significant.What's even worse is that depending on which capitalization you use the first time you initialize a
RegionInfoinstance the results will be cached and be returned on subsequent initializations of instances regardless of capitalization.Quick sample code that demonstrates the issue:
If we change the order we initialize the instances, we get a completely different output:
It is expected that both capitalizations of the country code should return the same
NativeNameregardless of which is used first..NET Core version: 3.1.302
OS: Windows 10, version 2004, build 19041.388