Max Max - 4 months ago 34
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?

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

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