In my code, I often use the following converters:
Convert.ToInt32(value, Cultureinfo.InvariantCulture); Convert.ToDecimal(value, CultureInfo.InvariantCulture);
Now I like to use TryParse functions due to recent errors. I'm not quite sure if I am using the following equivalents correctly, as I do not fully understand the NumberStyles enumeration.
Int64.TryParse(value, NumberStyles.Any, CultureInfo.invariantCulture, out output); Decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out output);
CHANGE BELOW after replies
The following code should be the correct alternative:
Int64.TryParse(value, NumberStyles.Integer, CultureInfo.invariantCulture, out output); Decimal.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out output);
source share