How to convert number (dec) to binary (bin) number and from bin to dec?
How to convert number (dec) to binary (bin) number and from bin to dec 开发者_Python百科using C# and Winforms?
Try this
string binValue = Convert.ToString(myInt, 2);
int intValue = Convert.ToInt32(myBinary, 2);
Example:
string binValue = Convert.ToString(16, 2); // = 10000
int intValue = Convert.ToInt32("11010", 2); // = 26
精彩评论