Convert a System.String into a System.Boolean using System.Convert : System Convert : Data Type C# Examples


C# Examples » Data Type » System Convert »

 

Convert a System.String into a System.Boolean using System.Convert









    
using  System;

using  System.Globalization;

class  MainClass
{
    static  void  Main(string[]  args)
    {            
        string  theString  =  "true";
        Console.WriteLine("Convert.ToBoolean(theString)");                
        bool  theBool  =  Convert.ToBoolean(theString);
        Console.WriteLine("Type  code  string  converted  to  bool  is:  {0}",  theBool.GetTypeCode());
        Console.WriteLine("Value  of  converted  string:  {0}",  theBool);
    }
}
    
   
  
   



Output

Convert.ToBoolean(theString)
Type code string converted to bool is: Boolean
Value of converted string: True


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» System Convert