title: C# List - Group By - Without Linq
body: <p>I have an object:</p>
  
  <pre><code>IObject
  {
      string Account,
      decimal Amount
  }
  </code></pre>
  
  <p>How do I group by Account and Sum the Amount, returning a List without Linq.</p>
  
  <p>2.0 Framework ... that is why no Linq.</p>
  
  <p>Here is what I have:</p>
  
  <pre><code>    ListofObjects = List&lt;IObject&gt;;
  
      foreach (var object in objects)
      {
          var objectToAdd = new Object(object);
  
          var oa = ListofObjects.Find(x =&gt; x.Account == objectToAdd.Account);
  
          if (oa == null)
          {
              ListofObjects.Add(objectToAdd);
          }
          else
          {
              ListofObjects.Remove(oa);
              oa.Amount = objectToAdd.Amount;
              ListofObjects.Add(oa);
          }
  
  
      }
  </code></pre>