SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 231 | Next

Scott Klein

"Professional LINQ"


Snohomish
WA

Mr. SciFi
05/14/2002
M

135
Part II: LINQ to XML

Joe

222 Main St.
Easley
SC

All Things Bleeding Edge
07/22/2004
M


The following example queries the XML document, looking at the Geek attribute of the Employee node
and returning only those with a value of True:
IEnumerable empNames =
from emp in employees.Elements("Employee")
where (string)emp.Attribute("Geek") == "True"
select emp;
foreach (XElement name in empNames)
textbox1.Text = name.ToString();
The query expression returns the following values:
Scott
Joe
This last example demonstrates how to walk an XML tree looking for an element value several layers
deep. First, modify the XML and add a Zip element to the employee with an id of 2:

Steve

444 Main St.


Pages:
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6