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

Scott Klein

"Professional LINQ"

org}Title", "Developer")
);
This produces the following XML:

Scott
Developer

LINQ to XML also provides a class to assist in working with namespaces, and that class is the
XNamespace class. Namespaces can also be defined and created via the XNamespace class. This class represents
an XML namespace and cannot be inherited. The following example defines a default namespace
that is used in the subsequent XML document:
XNamespace xn = "http://wrox.com";
XElement employee = new XElement( xn + "Employee",
new XAttribute("id", "1"),
new XElement( xn + "Name", "Scott"),
142
Chapter 6: Programming with LINQ to XML
new XElement(xn + "Title", "Developer")
);
This code produces the following XML:

Scott
Developer

You should begin to see that working with namespaces in LINQ to XML is quite easy. LINQ to XML
removes a lot of the frustration you experience with other XML technologies and makes working with
XML documents a pleasure.


Pages:
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6