Different Node Value Types Retrieved via Casting to the Node Value's Type
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
public class MainClass {
public static void Main() {
XElement count = new XElement("Count", 12);
Console.WriteLine(count);
Console.WriteLine((int)count);
XElement smoker = new XElement("Smoker", false);
Console.WriteLine(smoker);
Console.WriteLine((bool)smoker);
XElement pi = new XElement("Pi", 3.1415926535);
Console.WriteLine(pi);
Console.WriteLine((double)pi);
}
}
Related examples in the same category