I call the following two lines. Second line failed:
var a = long.Parse("2,147,483,648", NumberStyles.AllowThousands); var b = long.Parse("-2,147,483,648", NumberStyles.AllowThousands);
However, if I change the values so that I don't have the "," characters and delete the NumberStyles enumeration, it works. eg.
var a = long.Parse("2147483648"); var b = long.Parse("-2147483648");
Am I doing something wrong? Is this a known issue? Is there an acceptable job that doesn't involve hacker string manipulation?
edit . I should have mentioned the exception: System.FormatException , "The input string was not in the correct format."
source share