Possible Duplicate:
Use XML Literals in C#?
I can do this in Visual Basic, How can I do this in C#
Dim xmlTree As XElement = <Employees></Employees>
Possible Duplicate:
Use XML Literals in C#?
I can do this in Visual Basic, How can I do this in C#
Dim xmlTree As XElement = <Employees></Employees>
Try:
XDocument document = XDocument.Parse("<Employees></Employees>")
or
XElement root = new XElement("Employees")
Another way is using XmlDocument
class:
XmlDocument document = new XmlDocument();
document.LoadXml("<Employees></Employees>");
but I recommend to use XDocument. It is newer than XmlDocument
, it has more clean API and support Linq To Xml.