0

I have an extra decimal string, which i have to convert to decimal value. I am doing this now. it works for smaller values , for larger values it fails.

long.TryParse(hexadecimalstringinput, System.Globalization.NumberStyles.HexNumber, null, out convertedValue))

For inputs such as "FFFF_FFFF_FFFF_FFFF_FFFF" it fails. Any alternate approach for this?

4
  • 3
    is FFFF_FFFF_FFFF_FFFF_FFFF a valid hexadecimal string? Commented Nov 19, 2019 at 7:10
  • 5
    You would need 80 bits to store a 20 digit hex number anyway, which is too many bits for a long. Commented Nov 19, 2019 at 7:12
  • this might help you, have a look at below link stackoverflow.com/a/27362463/8279616 Commented Nov 19, 2019 at 7:16
  • maybe this will help you: stackoverflow.com/questions/227731/int128-in-net Commented Nov 19, 2019 at 8:15

1 Answer 1

1

If you really need to handle such values, take a look on BigInteger: MSDN BigInteger

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.