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//www . j a v  a  2  s .  c o  m
{
    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