CSharp - Cast a Node to a Different Data Type Than Its Value's Original Data Type

Description

Cast a Node to a Different Data Type Than Its Value's Original Data Type

Demo

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

class Program//from   www . j  a  v a2 s . co m
{
    static void Main(string[] args){
        XElement smoker = new XElement("Smoker", "true");
        Console.WriteLine(smoker);
        Console.WriteLine((bool)smoker);
    }
}

Result

Related Topic