I’m trying to convert this JavaScript code to C#. It is a hexadecimal string that is the value of a crypto token.
Here is what works in JavaScript:
parseInt("0x0000000000000000000000000000000000000000000000056bc75e2d63100000", 16)
Here is what I have tried in C#:
var result = Int16.Parse("0x0000000000000000000000000000000000000000000000056bc75e2d63100000");
I get the error Input string was not in a correct format. What am I doing wrong?
>Solution :
the number is too large for int.
void Main()
{
string x = "0x0000000000000000000000000000000000000000000000056bc75e2d63100000";
new System.ComponentModel.Int128Converter().ConvertFromString(x).Dump();
}
result would be 100000000000000000000