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

Scott Klein

"Professional LINQ"

"),
new XElement("City", "Wellington"),
new XElement("State", "FL")
)
);
employee.Element("Employee").SetElementValue("Address", "111 Main St.");
Running this code shows that the address has indeed been changed:


Scott
111 Main St.

Wellington
FL


115
Part II: LINQ to XML
Delete
Deleting XML is as simple as navigating to the content you want to delete and calling the Remove() or
RemoveAll() method.
The following example creates an XML tree, and then adds an element that will be removed in the next
set of code:
XElement employee = new XElement("Root",
new XElement("Employee",
new XElement("Name", "Scott"),
new XElement("Address", "555 Main St."),
new XElement("City", "Wellington"),
new XElement("State", "FL")
)
);
XElement zip = new XElement("Zip", "33414");
employee.Add(zip);
Here??™s the resulting XML tree:


Scott
555 Main St.

Wellington
FL
33414


Now, remove the node you just added:
employee.


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