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

Scott Klein

"Professional LINQ"

Each attribute must have a qualified name that is unique
to the element. And attributes are maintained in the XML tree in the order that they are added to
the element.
The great thing, however, is that working with the XAttribute class is just like working with the
XElement class.
Here??™s how to add an attribute to a simple XML tree during construction:
XElement employee = new XElement("Root",
new XElement("Employee",
new XAttribute("id", "1")
)
);
And here??™s its output:



Just like elements, multiple attributes can be added at one time. For instance, you could add a phone
attribute along with the id attribute, like this:
XElement employee = new XElement("Root",
new XElement("Employee",
new XAttribute("id", "1"),
new XAttribute("phone", "555-555-5555")
)
);
And the output is as follows:



The key to attributes is that they must have a qualified name that is unique to the particular element to
which they are being added.
Unlike the XElement class, the XAttribute class has only a small handful of methods.


Pages:
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6