Language Integrated Query (LINQ) Question:

Download Job Interview Questions and Answers PDF

What is Difference between XElement and XDocument?

LINQ Interview Question
LINQ Interview Question

Answer:

Both are the classes defined by System.Xml.Linq namespace
XElement class represents an XML fragment
XDocument class represents an entire XML document with all associated meta-data.
example:

XDocument d = new XDocument(
new XComment("hello"),
new XElement("book",
new XElement("bookname", "ASP.NET"),
new XElement("authorname", "techmedia"),
)
);

Download LINQ Interview Questions And Answers PDF

Previous QuestionNext Question
Write a program using LINQ to find the sum of first 5 prime numbers?What are Quantifiers?