Converting hex to int and back again in C#

No, nothing startling or new, but something I forget every time. So, to save myself searching for it again, here is how to convert a hex value to an integer…

Convert.ToInt32("ff", 16)

…and to convert an int to hex, you simply do…


Maybe now I’ve written a blog post about these, I might remember them next time.

Ha ha, fat chance!

Be First to Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.