How would I convert a string, say "-100,100", to long in C#.

I currently have a line of code which is

long xi = long.Parse(x, System.Globalization.NumberStyles.AllowThousands);

but this breaks when x is "a negative number".

My approach:

long xi = long.Parse("-100,253,1", 
System.Globalization.NumberStyles.AllowLeadingSign & System.Globalization.NumberStyles.AllowThousands);

was wrong, as it broke.

Edit
Report