I have a csv file that stores long values in this format:
0x0000000000000001
0x0000000000000002
0x0000000000000020
0x0000000000040000
I want to save the values in long variables. I can save the data directly as long for example:
long t = 0x0000000000040000;
This does not throw an exception.
However, I can't seem to convert this format from string (as i read it from the csv file) to long.
I tried
Convert.ToInt64("0x0000000000040000");
as suggested in this question
I also tried
long.Parse("0x0000000000040000", NumberStyles.HexNumber);
But this throws also an exception
I can parse it when I get rid of the 0x at the front. But the number is then saved without the zeros (e.g. 0x0000000000000001 becomes just 1), which is not what I want.
Tl;dr:
Does anyone know how to parse
string s = "0x0000000000000001";
to
long l = 0x0000000000000001;
?