C# Base 2 To Decimal
To convert decimal numbers to base 2, I use:
int base2 = 开发者_运维知识库10;
Convert.ToString(base2, 2);
Output:
1010
But how can I do the opposite? i.e:
Input : 1010
Output : 10
Try:
Convert.ToInt32("101010", 2)
you can do Convert.ToInt32("1010",2);
精彩评论