Max Max - 1 year ago 80
C# Question

easy and fast way to convert an int to binary?

What I am looking for is something like PHPs

function in C#. That function converts decimals to its representation as a string.

For example, when using
it returns
as result.

I found this function which basically does what I want, but maybe there is a better / faster way?

Answer Source
var result = Convert.ToString(number, 2);

– Almost the only use for the (otherwise useless) Convert class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download