0

I am parsing a string number like 100.2543 to a double.

double actualValue = double.Parse(stringToParse, NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat);

What is the difference to the same method but not using NumberStyles.Any? Is .Any by default?

double actualValue = double.Parse(stringToParse,CultureInfo.CurrentCulture.NumberFormat);
Pascal
  • 12,265
  • 25
  • 103
  • 195

2 Answers2

0

What is the difference to the same method but not using NumberStyles.Any? Is .Any by default?

The difference, in your case, does not matter because 100.2543 this is just a natural double. .Any is just for basic double format.

But if it was something like €100.2543, now NumberStyles.AllowCurrencySymbol would fit in this case. And there are other usages of NumberStyles on msdn documentation.

Pretty sure you get the idea, here is for complete documantation link. https://msdn.microsoft.com/en-us/library/system.globalization.numberstyles(v=vs.110).aspx

0

Did you look in MSDN?

The s parameter is interpreted using a combination of the NumberStyles.Float and NumberStyles.AllowThousands flags.

shay__
  • 3,815
  • 17
  • 34