Prev | Current Page 241 | Next

Satheesh, N Kumar

"LINQ Quickly"

It actually transforms one form of data into
another, instead of manipulating it.
LINQ to XSD
[ 164 ]
The following code shows how to build an un-typed XML tree using functional
construction. Here, we use XElement to build a new Icecream element and add it to
the existing Icecream element. For adding each element, we have to use XElement
with the element name and value as parameters.
Icecream.Add
(
new XElement("Icecream",
new XElement("Name", "Rum Raisin Ice Cream"),
new XElement("Ingredients", "Rum, guar gum, nonfat milk, cream,
alomnds,
sugar, raisins, honey, chocolate, annatto color..."),
new XElement("Cholesterol", "49mg"),
new XElement("TotalCarbohydrates", "28g"),
new XElement("Protein",
new XElement("VitaminA", "2g"),
new XElement("Calcium", "1g"),
new XElement("Iron", "4g")),
new XElement("TotalFat", "16g",
new XElement("SaturatedFat", "5g"),
new XElement("TransFat", "3g"))
)
);
Now we will see how to add a new element to the typed XML, without using
XElement. We can directly use the objects to add the elements.


Pages:
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
wynajem sal szkoleniowych warszawa twarożek ze szczypiorkiem pustaki szklane mobilna suwnica hydrauliczna Poznań miller