class Program
{
static void Main(string[] args)
{
CultureInfo Greek = CultureInfo.GetCultureInfo("el-GR");
CultureInfo US = CultureInfo.GetCultureInfo("en-US");
string storedValue = "649.54";
double amount = 0;
double.TryParse(storedValue, NumberStyles.Any, Greek, out amount);
Console.WriteLine("Current Culture = {0} , Amount = {1}", Greek, amount); --Output 64954
double.TryParse(storedValue, NumberStyles.Any, US, out amount);
Console.WriteLine("Current Culture = {0} , Amount = {1}", US, amount);
--Output 649.54
Console.ReadKey();
}
}
When the culture is in "en-us" working perfectly but when the culture is in "el-GR" it is showing the output in wrong format. Please help me to parse so that it can work for any culture in c# for numbers.