Answers for "transform bool to int c#"

C#
2

transform bool to int c#

using System; //Needed for Convert
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Convert.ToInt32(true) : " + Convert.ToInt32(true));
            Console.WriteLine("Convert.ToInt32(false): " + Convert.ToInt32(false));

            //hit ENTER to exit
            Console.ReadLine();
          //OutPut: Convert.ToInt32(true) : 1
          //		Convert.ToInt32(false): 0
          
        }
    }
}
Posted by: Guest on January-12-2021

C# Answers by Framework

Browse Popular Code Answers by Language