Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Is there any reason behind Convert.ToIntXX(string) not accepting number group separator?

$
0
0

According to the Culture-Specific Formatting Information part of Remarks in the Convert Class description, and Remarks of Convert.ToInt16(string), Convert.ToInt32(string) and Convert.ToInt64(string), it seems logical that a string containing number group separator (e.g. "," for en-US culture) is converted without raising format exception.

Currently, for integer conversions with the formatted string, other methods such as Parse(string, NumberStyle) is needed.

Is there any reason why Convert.ToDouble(string) and Convert.ToDecimal(string) allows culture-specific format (i.e. containing number group separator) but not the integer conversion functions?



Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>