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 232 | Next

Scott Klein

"Professional LINQ"


Snohomish
WA
99999

Mr. SciFi
05/14/2002
M

In the following example, the query expression walks down to the
element and looks for an
employee with a Zip value of 99999:
IEnumerable empAddr =
from emp in employees.Elements("Employee").Elements("Address")
where (string)emp.Element("zip") == ("99999")
136
Chapter 6: Programming with LINQ to XML
select emp;
foreach (XElement address in empAddr)
textbox1.Text = address.ToString();
There was only a single employee that matched the query expression filter in this example, but nonetheless,
the results were looped through, and the following XML was returned:

444 Main St.
Snohomish
WA
99999

This example returned the address information for the selected ZIP code. Modify the query as highlighted
here, and it will return the entire employee node for the selected ZIP code:
IEnumerable empAddr =
from emp in employees.


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