Functional Construction : Ability to create a XML document tree in a single statement.
Some classes of C# used to create XML document:
- XDocument : Used to create xml document
- XDeclaration: Used to create xml declaration
- XComment : Used to give comment
- XElement : To create root element or sub elements.
- XAttribute : To create attribute of elements
Code to create above XML document using C#:
3 - Query XML document using LINQ:
Lets retrieve students from above XML who have total marks more than 800 and sort in descending order.
4 - Modify XML document by LINQ to XML:
Transfer XML to CSV file: