C# convert integer to hex and back again

Posted by codette on Stack Overflow See other posts from Stack Overflow or by codette
Published on 2009-07-16T20:05:00Z Indexed on 2010/05/03 12:48 UTC
Read the original article Hit count: 263

Filed under:
|

How can I convert the following?

2934 (integer) to B76 (hex)

Let me explain what I am trying to do. I have User IDs in my database that are stored as integers. Rather than having users reference their IDs I want to let them use the hex value. The main reason is because it's shorter.

So not only do I need to go from integer to hex but I also need to go from hex to integer.

Is there an easy way to do this in C#?

© Stack Overflow or respective owner

Related posts about c#

Related posts about hex