Gold Gold - 5 months ago 27
C# Question

How to convert binary to decimal

How can I convert a binary string, such as

1001101
to Decimal? (77)

Answer

The Convert.ToInt32 method has an overload that accepts a base parameter.

Convert.ToInt32("1001101", 2).ToString();