xelement root = xelement.load(file); // .parse(string)
list<string> names = root.descendants().distinct(x => x.name.localname).tolist();
names.foreach(name => root.descendants(name).skip(1).remove());
root.save(file); // or root.tostring()
foreach (xmlnode child
in node.childnodes.distinct(custom comparer that looks on node names))
- How can I remove duplicate, invalid, child nodes from an XML document using Linq to XML?
- How can i remove the duplicate element from a xml document without scribbling the structure of xml using c#
- How to remove duplicate nodes in linq to xml document
- Remove Last 30 Days Nodes from XML Document using linq
- How to remove duplicate combinations from a List<string> using LINQ
- how i can get a <w:pict> tag from word document using open xml
- How could I create single list from Parent and child node from XML using Linq
- Reading child nodes from xml string using C#, LINQ
- How can i get all subnode values separately from XML Response using LINQ to XML?
- remove a duplicate element(with specific value) from xml using linq
- How do you populate a parent child data structure from XML where generic List<> objects are in parent and child structures using one LINQ query?
- How can I select specific elements from an XML using Linq to Xml?
- How can I get a list of text from an xml document using c#?
- C# LINQ to XML - How can I filter nodes based on a child element?
- How to get same element value from xml which having same and different nodes using linq in c#
- How can I filter a dictionary using LINQ and return it to a dictionary from the same type
- How to remove duplicates from collection using IEqualityComparer, LinQ Distinct
- How to remove an element from an xml using Xdocument when we have multiple elements with same name but different attributes
- How do I remove items from generic list, based on multiple conditions and using linq
- How to remove characters from a string using LINQ
- How to properly search xml document using LINQ C#
- How to find duplicate record using Linq from DataTable
- using LINQ how can i concatenate string properties from itesm in a collection
- How to remove duplicates from an Array using LINQ
- How to get strongly-typed collection from XML using Linq
- How to get the exact child element with corresponding parent only from multilevel embedded MongoDB document using C#
- How can I use Linq to build a c# object from xml where an element has zero or more elements of the same type?
- Select descendent nodes and elements from an XML using LINQ
- How can I get the top three players and their high scores from a collection using linq and lambdas
- Using C# & LINQ how can I find duplicate file names?
More Query from same tag
- How to read NotMapped properties in EF 5?
- "Expression type 'NhDistinctExpression' is not supported by this SelectClauseVisitor." - with Query Syntax
- LINQ-to-Entities Find DateTime difference
- C# order a list of alphanumeric numbers
- Translate from LINQ query syntax to method syntax
- Pass LINQ query to VIewBag to create DropDownList
- Use "Sum" Into Select new class
- Is there a better way to do this LINQ statement block?
- Linq GroupBy deep compare
- Coalesce potentially Empty LINQ query results
- Linq: Using Distinct on calculated result
- Did I really just put a string data type into an IEnumerable<int>
- Grouping and remove from list
- linq query on multiple columns from a list of objects
- SQL 'IN' operator in LINQ to Entities
- Entity Framework Lazy and Eager loading returns System.Data.Entity.DynamicProxies.PropertyName
- How to Add to an ObservableCollection<T> Item with LINQ Where() in Getter?
- Cannot be constructed in a LINQ to Entities query. Error
- How to group by custom types with linq
- Linq Sorted Groupby and Orderby fields
- How can I dynamically store expressions used for Linq Orderby?
- Why it give me the same output?
- Linq .Contains or IN
- Linq To SQL Attach/Refresh Entity Object
- produce intersection and decomposition lists with two generic lists
- Calculate Player WinLoss Percentage
- How to export linq result to excel just like Linqpad
- Get each item from a list and compare it with a different one
- Linq statement to make a list of Int to a list of list of int .NET
- Linq and .Count big database