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

Scott Klein

"Professional LINQ"

Remove(zip);
The XML tree now looks like this:


Scott
555 Main St.

Wellington
FL


Likewise, you can use the RemoveAll() method to remove all the nodes (including child nodes) and
attributes for the given element:
XElement employee = new XElement("Root",
new XElement("Employee",
new XElement("Name", "Scott"),
116
Chapter 5: Understanding LINQ to XML
new XElement("Address", "555 Main St."),
new XElement("City", "Wellington"),
new XElement("State", "FL")
)
);
Employee.RemoveAll();
Here??™s the resulting XML:

Working with Attributes
Attributes are name/value pairs that are associated an XML element. By now you know quite a bit about
dealing with elements via the XElement class, and the good news is that dealing with attributes via the
XAttribute class is not much different. The following sections explain how to work with attributes in an
XML tree, specifically adding, retrieving, and deleting attributes.
Adding
Adding attributes with LINQ to XML is similar to adding elements.


Pages:
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6