How to convert dec to hex and binary

M

Morten Wennevik

Hi Soon Lee,

If you by dec mean base 10 numbers, then you can use
Convert.ToString(number, base).

int n = 15;
string s1 = Convert.ToString(n, 2); // == 1111
string s2 = Convert.ToString(n, 16); // == f
 

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

Top