Top "Linq-to-xml" questions

LINQ-to-XML provides a SQL-like query experience for navigating, parsing, and aggregating data stored in XML documents.

Performance: XmlSerializer vs XmlReader vs XmlDocument vs XDocument

I'm working on a little web project and would like to read/write to an XML file. Performance is my …

.net linq-to-xml xmldocument xmlserializer xmlreader
LINQ to XML optional element query

I'm working with an existing XML document which has a structure (in part) like so: <Group> <Entry&…

c# linq linq-to-xml anonymous-types
Why is my XDocument saving the declaration when I don't want it to?

I have the following code: class Program { static void Main(string[] args) { using (var stream = File.Create(@"C:\test.xml")) { …

c# xml linq-to-xml
How to Cast to Generic Parameter in C#?

I'm trying to write a generic method for fetching an XElement value in a strongly-typed fashion. Here's what I have: …

c# generics casting linq-to-xml xelement
How to add value between tags using XElement?

I have looked a bunch of XML samples using XDocument and XElement but they all seem to have self closing …

c# xml linq-to-xml xelement
Querying xml child elements with prefixed namespace using LINQ to XML

So I have some XML that generally looks like this <wd:Data xmlns:wd="urn:com.foo.bar/GetResult"&…

c# linq linq-to-xml xelement
Convert Dictionary to XML using C#

I have my XML File as follows: <states> <state name ="Alaska"> <Location Name="loc1"> &…

asp.net c#-4.0 dictionary linq-to-xml idictionary
Which is the best for performance wise: XPathNavigator with XPath vs Linq to Xml with query?

I have an application in which I am using XPathNavigator to iterate nodes. It is working fine. But I want …

c# .net-4.0 linq-to-xml xmldocument xpathnavigator
XElement and List<T>

I have a class that has the following properties: public class Author { public string FirstName { get; set; } public string LastName { …

c# .net linq-to-xml xelement
3 nested groups with linq

I am trying to get 4 List deep List collection, List<List<List<List<int>>&…

c# .net xml linq-to-xml nested-groups