I have to admit I am LOVING how easy it is to whip out an XDocument with some XElements in only a couple of lines of code.
var xmlData = new XElement("Transactions",
from trans in dc.Transactions
select new XElement("Transaction",
new XElement("Date", trans.Date),
new XElement("Amt", trans.Amt)));
It's pretty flexible in that if you dont want the generic var, you could actually create a strongly typed XElement instead.
This makes it a snap to do things like create a single XDocument - and then piece together the document from different data sources or database servers.
0 comments:
Post a Comment