You can also use casts in LINQ queries.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
class Program
{
static void Main()
{
var data = XElement.Parse(@" ");
IEnumerable query = from cust in data.Elements()
where (int?)cust.Attribute("credit") > 100
select cust.Attribute("name").Value;
foreach(string s in query){
Console.WriteLine(s);
}
}
}
The output:
B