CSharp - Cast to a Bool Calls the System.Xml.XmlConvert.ToBoolean Method

Description

Cast to a Bool Calls the System.Xml.XmlConvert.ToBoolean Method

Demo

using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;

class Program//from  ww w  .  j a  va  2 s. com
{
    static void Main(string[] args){
        try
        {
          XElement smoker = new XElement("Smoker", "True");
          Console.WriteLine(smoker);
          Console.WriteLine((bool)smoker);
        }
        catch (Exception ex)
        {
          Console.WriteLine(ex);
        }
    }
}

Result

Related Topic