Monday 4 January 2016

convert hexadecimal to decimal c#

I tried to find out but did not get proper solution for convert hexadecimal to decimal c# and finally after some research i find it out. So thats why  posting that solution even it is one liner.

string hexValue = "00037FFEBCCBD966";



            Decimal result = long.Parse(hexValue,System.Globalization.NumberStyles.HexNumber);

You will get the result for decimal as 985156996028774M.

Getting M as showing as the decimal i converted it to the string format as;

  string result =( long.Parse(hexValue, System.Globalization.NumberStyles.HexNumber)).ToString();

No comments:

Post a Comment