dominicwong
asked on
How to convert a 39-decimal characters into hex in c#
Hi experts
I've a string representation of a 39-characters long decimal integer.
I need to convert this into hex format in C#.
eg. 34028236692093846346337460 7431768211 455 (39 characters)
-> ffffffffffffffffffffffffff ffffff (32 characters)
By the same token, I need to be able to reverse the operation from hex to decimal.
I am using C# .NET 3.5 which hasn't got BigInteger.
Any advice please. Thanks in advance.
I've a string representation of a 39-characters long decimal integer.
I need to convert this into hex format in C#.
eg. 34028236692093846346337460
-> ffffffffffffffffffffffffff
By the same token, I need to be able to reverse the operation from hex to decimal.
I am using C# .NET 3.5 which hasn't got BigInteger.
Any advice please. Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BigInteger is part of .net 4, OP is working with .net 3.5
ASKER
Thanks QuinnDex. That works like a charm, and is exactly what I need.
Thanks also to JamesBurger for your help.
Thanks also to JamesBurger for your help.
If you can get a string representation of your value, the following will do the job:
BigInteger bigInt = BigInteger.Parse ( "3402823669209384634633746
string bigHex = bigInt.ToString ("X");
bigInt = BigInteger.Parse ( bigHex, System.Globalization.Numbe
Otherwise, give a look at the BigInteger Structure in the documentation, it is quite exhaustive.