Hex to int conversion support

  • Thread starter Thread starter R Lee
  • Start date Start date
R

R Lee

Newbie trying to play around with forms creating a int to hex converter.
Does the framework have a conversion class? I can't believe that yet
another needs to be created.

Thanks for the feedback
Ron
 
R Lee said:
Newbie trying to play around with forms creating a int to hex converter.
Does the framework have a conversion class? I can't believe that yet
another needs to be created.

Just use the appropriate format specifier, x or X:

int i = 123;
string s = i.ToString("x");

s is now "7b"

See also Convert.ToString(int, int).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top