Introduction Today, in this article let's play around with one of the interesting and most useful concepts in LINQ to XML. Question: What is adding attribute to XML using LINQ to XML? In simple terms "It provides flexibility to add a new XAttribute to XML with help of a LINQ query." Step 1: Create an "ASP.NET Web Application", as in:
Step 2: The complete code of Employee.xml looks like this:
Step 6: The data entering output of the application looks like this
Step 7: The attribute added to XML looks like this: