score:6
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.
score:8
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.
score:8
XDocument has a Declaration, Root while XElement is a single node.
Source: stackoverflow.com
Related Articles
- difference between XElement and XDocument
- Difference between the returned values of two selector functions in this code
- 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
- Get the difference between two lists using LINQ
- Difference between the implementation of var in Javascript and C#
- Is there a difference between Select * and Select [list each col]
- Is there a way to get the difference between two sets of objects in c#
- 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?
- How to get difference between two DataTables
- Difference between “Equals” and “SequenceEqual”?
- When using LINQ, what is the difference between && and multiple where clauses?
- finding difference between two dictionaries
- Linq Double contains
- Select only a single column in LINQ
- How do I iterate an IGrouping<T> Interface?
- Displaying content under an ID
- LINQ to XML - list of custom objects with attributes from parent
- Need to count duplicates using linq and bind it to chart
- Convert simple t-sql query to linq
- Dynamic Linq queries with sorting, nulls at end
- Accessing value from expression
- How to get datetime group by days via LINQ C#
- What can map database tables like LINQ to SQL did?
- DataContext invalid object
- LINQ Logic, Navigating to the ApplicationUser Identity table, roles and a business object called project
- LINQ query for getting row with max date in grouped table
- How to implement Linq on DataTable
- Code Example for Add DateTime and TimeSpan in EF query
- EF Core Group On Nav Properties
- C# CSV dynamic split
- Need message size for each child record
- Linq and ASP.NET MVC: Order data from latest to previous