开发者

C# Base 2 To Decimal

开发者 https://www.devze.com 2023-02-06 22:30 出处:网络
To convert decimal numbers to base 2, I use: int base2 = 开发者_运维知识库10; Convert.ToString(base2, 2);

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);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号