How to convert binary string to integer in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main(string[] args)
    {
        string binary = "1011001011";

        int n = Convert.ToInt32(binary, 2);

        Console.WriteLine(n);
    }
}



/*
run:

715

*/

 



answered Jul 18, 2025 by avibootz
...