title: Select distinct customers and sum orders from XML file using LINQ
body: <p>So far, I have a simple LINQ query using an XML file to build a dictionary or customerid and order:</p>
  
  <blockquote>
    <p>var Limit = from c in xml.Descendants("Customer")
                                  select new
                                  {
                                      customerID = c.Descendants("customerid").First().Value,
                                      order = c.Descendants("order").First().Value,</p>
  
  <pre><code>                          };
  </code></pre>
  </blockquote>
  
  <p>I need distinct customer IDs coming back and the total of the 'order's for each customerID. For example I have:</p>
  
  <p>CustomerID = 123     Order = 200</p>
  
  <p>CustomerID = 123     Order = 100</p>
  
  <p>CustomerID = 123     Order = 50</p>
  
  <p>CustomerID = 456 Order = 100</p>
  
  <p>CustomerID = 456 Order = 100</p>
  
  <p>and I need:</p>
  
  <p>Customer ID = 123   OrderTotal = 350</p>
  
  <p>CustomerID = 456   OrderTotal = 200               </p>
  
  <p>I know there are plenty of similar questions out there but I'm pretty new to LINQ.</p>
  
  <p>Thanks</p>