title: how to sum the values from an XML file based on certain criteria
body: <p>i need to sum up the values from an XML file based on some criteria<br/>
  my XMl Is as follows</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;transactions&gt;
      &lt;transcation ID="1"&gt;
          &lt;BankName&gt;ABC&lt;/BankName&gt;
          &lt;TemplatModel&gt;CT1&lt;/TemplatModel&gt;
          &lt;Date&gt;12/12/2014&lt;/Date&gt;
          &lt;Payeename&gt;xyz&lt;/Payeename&gt;
          &lt;Amount&gt;200&lt;/Amount&gt;
      &lt;/transcation&gt;
      &lt;transcation ID="2"&gt;
          &lt;BankName&gt;EFG&lt;/BankName&gt;
          &lt;TemplatModel&gt;CT2&lt;/TemplatModel&gt;
          &lt;Date&gt;12/12/2014&lt;/Date&gt;
          &lt;Payeename&gt;xyz&lt;/Payeename&gt;
          &lt;Amount&gt;100&lt;/Amount&gt;
      &lt;/transcation&gt;
      &lt;transcation ID="3"&gt;
          &lt;BankName&gt;ABC&lt;/BankName&gt;
          &lt;TemplatModel&gt;CT1&lt;/TemplatModel&gt;
          &lt;Date&gt;10/12/2014&lt;/Date&gt;
          &lt;Payeename&gt;pqr&lt;/Payeename&gt;
          &lt;Amount&gt;400&lt;/Amount&gt;
      &lt;/transcation&gt;
      &lt;transcation ID="4"&gt;
          &lt;BankName&gt;EFG&lt;/BankName&gt;
          &lt;TemplatModel&gt;CT2&lt;/TemplatModel&gt;
          &lt;Date&gt;11/12/2014&lt;/Date&gt;
          &lt;Payeename&gt;asd&lt;/Payeename&gt;
          &lt;Amount&gt;300&lt;/Amount&gt;
      &lt;/transcation&gt;
  &lt;/transactions&gt;
  </code></pre>
  
  <p>I need to find the sum of amount where <strong>BankName="ABC"</strong> and in another query i need to find the sum of amount whose <strong>date less than "12/12/2014"</strong></p>
  
  <p>and one more doubt which xml structure is better   </p>
  
  <pre><code>&lt;transactions&gt;
      &lt;transcation ID="1" BankName="ABC" TemplatModel="CT1" Date="12/12/2014" Payeename="asd" Amount="200"/&gt;
      &lt;transcation ID="2" BankName="EFG" TemplatModel="CT2" Date="12/12/2014" Payeename="xyz" Amount="100"/&gt;
      &lt;transcation ID="3" BankName="ABC" TemplatModel="CT1" Date="10/12/2014" Payeename="pqr" Amount="400"/&gt;
      &lt;transcation ID="4" BankName="EFG" TemplatModel="CT2" Date="11/12/2014" Payeename="asd" Amount="300"/&gt;
  &lt;/transactions&gt;
  </code></pre>
  
  <p><strong>Edited Question</strong></p>
  
  <p>i am getting an error when returning the query result to List</p>
  
  <pre><code> public static List&lt;string&gt; banksearch(string bankname, string sdate = null, string edate = null, string condition = null)
      { 
      }
  
  return transactions
                          .Where(t =&gt; t.BankName == bankname &amp;&amp; t.Date == startdate)
                           .Select(t =&gt; new
                                   {
                                       TransactionID = t.TransactionID,
                                       BankName = t.BankName,
                                       TemplateModel = t.TemplateModel,
                                       Date = t.Date,
                                       PayeeName = t.PayeeName,
                                       Amount = t.Amount
                                   }).ToList();
  </code></pre>
  
  <p>my error is </p>
  
  <pre><code>Error   2   Cannot implicitly convert type 'System.Collections.Generic.List&lt;AnonymousType#1&gt;' to 'System.Collections.Generic.List&lt;string&gt;'
  </code></pre>