Advertisement
ivandrofly

Sorting Customer Orders - C# linq / query

Dec 17th, 2013
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System;
  3. using System.Linq;
  4.  
  5. XDocument input = XDocument.Load(path1);
  6.  
  7.             input.Element("customers").Element("customer").Element("orders").ReplaceNodes(
  8.                 from node in input.Element("customers").Element("customer").Element("orders").Elements("order")
  9.                 orderby Convert.ToInt32(node.Element("id").Value)
  10.                 select node
  11.                 );
  12.             input.Save(outpath1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement