score:1
Accepted answer
You need to concatenate the nodes inside the XElement, like this:
node.Nodes().Aggregate(new StringBuilder(), (sb, n) => sb.Append(n.ToString())).ToString()
Or, in .Net 4.0:
String.Concat(node.Nodes())
score:2
Alternatively:
using System.Xml.XPath;
string xml = node.CreateNavigator().InnerXml;
Source: stackoverflow.com
Related Articles
- C# XElement: Node Formatting with HTML
- XElement with LINQ add node after specific node
- Return first XElement in node with greatest number of fields
- List or Array of String Contain specific word in Html Source Code
- Using XPath within a single XElement to find only nodes that has a child node with specific Attribute
- Selecting Child Node of XElement with LINQ Group By
- What does this C# code with an "arrow" mean and how is it called?
- How to determine if XElement.Elements() contains a node with a specific name?
- Find an XElement with a certain attribute name and value with LINQ
- Parsing html with the HTML Agility Pack and Linq
- Why doesn't this code compile in VS2010 with .NET 4.0?
- Why is this code with PredicateBuilder not working?
- Add namespaces with and without names to an XElement
- Query HTML file with LINQ
- Can you advise me a resource with LINQ/lambda code exercises?
- LINQ Source Code Available
- Linq with where clause in many-to-many EF Code First object
- I need a LINQ expression to find an XElement where the element name and attributes match an input node
- C# Code Contracts -- How to ensure that a collection of items contains items with unique properties?
- .NET 4 Code Contracts: "requires unproven: source != null"
- how to remove Xelement without its children node using LINQ?
- C#: Adding Columns To Bound DatagridView With Code
- Converting XElement to HTML string
- Query expressions over source type 'dynamic' or with a join sequence of type 'dynamic' are not allowed
- Adding HTML to an XElement
- How to query by where clause with EF code first
- C# - Linq optimize code with List and Where clause
- compressing code with C# generics
- Nodes selection inside HtmlNodeCollection with HTML Agility Pack
- Building Xml with XElement dynamically through recursion
- Unable to execute LINQ Where clause with generic lambda expression
- Count matching characters between two strings using LINQ
- Calculate grand totals from IEnumerable using LINQ instead of foreach
- Creating reusable chunks of LINQ to SQL
- How can I achieve SQL CASE statement from LINQ
- Get top 3 highest values from array with index
- Convert String To Int in LINQ
- EF 6 can't commit data to database from DGV
- How to round up time difference to the nearest seconds with string format?
- Outputting linq getting overflow exception
- Traversing a list, execute a method: Extension possible?
- Make dynamic dictionary from json file
- Any .NET ecommerce packages using MVC and Linq?
- How to improve this query and check for nullable objects inside linq-expression
- Can I access the NHibernate ISession instance from IQueryable?
- Using LINQ with Action to delete old files
- Equivalent of http://localhost/Odata/User(1)/Contacts in .NET webapi Odata Client
- How to select the last set of concatenated sequence from multiple similar sequence
- Query with Nullable Values using LINQ
- Linq - Orderby by ID Value