By design, the difference (in usage) is very small.
You sometimes need a full XDocument, if you want access to the processing instructions etc.
But the following is fine (for most purposes):
XElement doc = XElement.Load("file.xml");
While a similar construct with XmlElement would not work.
The difference is that an
XElement type represents an XML fragment while the
XDocument type represents an entire XML document with all associated meta-data.
XDocument has a Declaration, Root while XElement is a single node.
- difference between XElement and XDocument
- What is the difference between ((IEnumerable)source).OfType<T>() and source as IEnumerable<T>
- Difference Between Select and SelectMany
- What is the difference between IQueryable<T> and IEnumerable<T>?
- Difference between Lookup() and Dictionary(Of list())
- What's the difference between IQueryable and IEnumerable
- What is the difference between LINQ ToDictionary and ToLookup
- Linq: What is the difference between Select and Where
- What is the difference between "LINQ to Entities", "LINQ to SQL" and "LINQ to Dataset"
- Difference between Expression<Func<>> and Func<>
- C# Difference between First() and Find()
- What is difference between .edmx and .dbml file in linq?
- Difference between Select and Where in Entity Framework
- Difference between List.All() and List.TrueForAll()
- Linq: What is the difference between == and equals in a join?
- What is the difference between Contains and Any in LINQ?
- What's the difference between XElement.Load and XDocument.Load?
- Difference between expression lambda and statement lambda
- Is there a difference between Select * and Select [list each col]
- Linq way to get piecewise difference between element and next element in list
- What is the difference between System.Linq and System.Data.Linq?
- Difference between Query Expression and Method Expression in LINQ?
- Difference between “Equals” and “SequenceEqual”?
- When using LINQ, what is the difference between && and multiple where clauses?
- Performance Difference between LINQ and Stored Procedures
- Difference between PredicateBuilder<True> and PredicateBuilder<False>?
- What is the difference between LINQ query expressions and extension methods
- What is the difference between Linq, DLinq and XLinq?
- Difference between lambda and LINQ?
More Query from same tag
- Linq to SQL update multiple records in one query
- Query In Linq using joins
- How get Expression.Lambda<Func<T, bool>> generic
- Creating lists from XML with optional elements
- Short record of if / null
- Possible to return linked object with Stored Procedure
- Vb.net pare down a lists of objects
- How to change a value form ObservableCollection<AnyClass> with LINQ?
- Abstract sequence processing that involves state
- search function query linq
- How do I rewrite this to be more LINQy?
- select top n in sql ce wp7
- How to get DynamoTableItems type output to an IEnumeral list
- Linq to SQL: specified cast is not valid
- How to write a query in method syntax
- Entity Framework : better way to do many to many query?
- LINQ sequences - how are they chained in IL?
- Get object from a sub list c#
- NotSupportedException: LINQ to Entities does not recognize the method
- Linq Group by and get all values for a specific string rule returning all columns
- How to convert a JSON string using LINQ in C#
- JSON.NET and arrays using LINQ
- LINQ deferred (or immediate?) execution
- Custom Linq generator (AddDays) using NHibernate
- Entity Framework - How many trips to the database on DeleteObject
- Using IEnumerable<T> to parse XML
- Linq query where in list, performance what is the best?
- cannot use "Include" in Linqpad
- Search duplicates and fill list with them
- How to repeat the array elements with specific sequence according to some number?