Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
十进制转二进制的方法如下:
int dec = 42; string bin = Convert.ToString(dec, 2);
如果我有,如何将二进制转换为十进制
string bin = "0100101" int dec = ???
只需寻找反向调用 - Convert.ToInt32(value, fromBase):
Convert.ToInt32(value, fromBase)
int dec = Convert.ToInt32(bin, 2);