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

Scott Klein

"Professional LINQ"

ElementsAfterSelf("Element6");
foreach (XElement el in els)
listBox1.Items.Add(el.Name);
Just as before, you could write it as follows:
IEnumerable re = root.Element("Element4").ElementsAfterSelf("Element6");
foreach (XElement el in re)
listBox1.Items.Add(el.Name);
Both approaches produce the same result: Element6.
While this example illustrated the ElementsAfterSelf() method, the same concept applies to the ElementsBeforeSelf()
method as well.
LINQ to XML axis methods are best used when working with nodes of an XML tree; they enable
you to work at a finer level of detail. By efficiently using the axis methods, developers can quickly
and easily iterate through an XML tree working with collections, not just an individual element or
attribute.
LINQ to XML Events
LINQ to XML events provide notifications when a change is made to an XML tree. LINQ to XML provides
two events to handle changes to an XML tree: Changing and Changed. Both of these events are raised
when you modify the XML tree; they??™re discussed in detail in the following sections.


Pages:
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6