Thursday 29 January 2009

Best way to write XML in C#

This is my opinion the way to create XML within c# - LINQ to XML:

var root =

new XElement("content",

new XAttribute("id", node.Id),

new XAttribute("url", node.NiceUrl),

new XAttribute("title", property != null ? property.Value : node.Name)

);

No comments: