Possible Duplicate:
How to pad a binary string with zeros?
I am able to convert decimal numbers to binary but not in an 8 bit format. For example if I input 5
the result is 101
which is correct but how can I show the result in an 8 bit format such as 00000101
?
string result = Convert.ToString(num, 2).PadLeft(8, '0');