How To Read XML File Using LINQ

In this code snippet we will learn how to read xml file using Linq ,the following is the simple code which reads the xml file

var xmldoc = XDocument.Load(@"E:/VS 2010 Projects/ReadXMLFileUsingLINQ/XMLFile.xml");  
      var results = from Emp in xmldoc.Descendants("empdetails")  
                    select Emp;  

I hope this code snippet is useful ,if you have any suggestion regarding this article then please contact me.

Post a Comment

Protected by Copyscape
Copyright © Compilemode