title: Extension method, SumIf on generic List<T>
body: <p>I need to write an generic extension method for List(T) that conditionally considers each string property of T, then sums a corresponding decimal property of T if a condition is met. My effort thus far:</p>
  
  <pre><code>// foreach(p in Persons) { if(p.Name == "mort"){sum p.Amount;} }
  
  public static double SumIf&lt;T&gt;(this T o, List&lt;T&gt; ListItems, 
            string targetStr, ?strVals?, ?dblVals?)
  {
      double sum = 0;
      foreach(T item in ListItems)
      {
          if(item.?strVal? == targetStr){ sum += item.?dblVal? ; }
      }
      return sum;
  }
  </code></pre>
  
  <p>Thanks for any guidance,
  mort</p>