我想转换writen在一个字符串到其整数值二进制数。
I would like to convert a binary number writen in a String into its integer value.
例如:
string input = "0101";
int output = convert(input);
输出
应等于 5
编辑:这真是小巫见大巫有人问,因为我有另外的错误,在我的code不使我看到,皈依是不是我的问题。
This really trivial question was asked because I had another bug in my code not enabling me to see that the convertion was not my problem.
Convert.ToInt32(字符串,的Int32 )允许您指定的基地:
int output = Convert.ToInt32(input, 2);