// Add 5 new purple Fords to the incoming document.
for (int i = 0; i < 5; i++)
{
// Create a new XElement
XElement newCar =
new XElement("Car", new XAttribute("ID", i + 1000),
new XElement("Color", "Green"),
new XElement("Make", "Ford"),
new XElement("PetName", "")
);
// Add to doc.
doc.Add(newCar);
}
// Show the updates.
Console.WriteLine(doc);
}
That wraps up our look at the major LINQ APIs that ship with .NET 3.5, and this chapter as
well! Over the remainder of this book, you will find various LINQ queries where appropriate; how-
ever, be aware that each of the APIs examined here (LINQ to DataSet, LINQ to SQL, and LINQ to
XML) are extensively documented in the .NET Framework 3.5 SDK documentation.
Do'stlaringiz bilan baham: |