0

Any hints on parsing / converting / operating on hex values in c# ?

In particular I want to cast a decimal int to hex and then output as a string...

penderi
  • 8,673
  • 5
  • 45
  • 62

1 Answers1

1
Int32 decValue = 42;
string hexValue = decValue.ToString("X");

Int32 decValue2 = Int32.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);

See this post:

How to convert numbers between hexadecimal and decimal in C#?

Community
  • 1
  • 1
Mark Ingram
  • 71,849
  • 51
  • 176
  • 230