471,325 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

How to convert dec to hex and binary

ANy one know of any fast method in converting dec to hex or bin?

--
WebSite : http://soonlee.agreatserver.com
Jul 21 '05 #1
1 1831
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
--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by John A Grandy | last post: by
3 posts views Thread by bussiere maillist | last post: by
7 posts views Thread by elliotng.ee | last post: by
29 posts views Thread by Harlin Seritt | last post: by
5 posts views Thread by =?Utf-8?B?YmJkb2J1ZGR5?= | last post: by
6 posts views Thread by Bob Altman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.