title: Iterating over lists and summing and putting result in dictionary
body: <p>Suppose i have two (could be more) lists of same object having same fields/properties.
  Each list represent the same object</p>
  
  <p><strong>Proerpties:</strong></p>
  
  <pre><code>HoursWorked
  HoursRate
  </code></pre>
  
  <p>I want to take iterate and take sum of each field from all lists (could be 2, 3, or so on) and store it in an dictionary with key value pair. <code>e.g HoursWorked:2 and HourseRate:6</code></p>
  
  <p><strong>Currently</strong>, i am able to do it for only one field only (hard coded). I want to make it generic so i can fill dictionary with Key/Value for all fields.</p>
  
  <p>I have defined my dictionary as follow</p>
  
  <pre><code>public Dictionary&lt;string, double&gt; TotalCount { get; set; }
  </code></pre>
  
  <p>Linq Query:</p>
  
  <pre><code>Dictionary&lt;string, double&gt; totalCount = records
  .GroupBy(x =&gt; records)
  .ToDictionary(x =&gt; Convert.ToString("HoursWorked"), x =&gt; x.Where(y =&gt; y.HoursWorked != null).Sum(y =&gt; y.HoursWorked).Value);
  </code></pre>
  
  <p>Any help on this?</p>
  
  <p><strong>Sample Data</strong>:</p>
  
  <pre><code>Input
      report = 
      { 
      [HoursWorked: 1.0, HoursRate:10], 
      [HoursWork:2.0, HoursRate:15]
      }
  
  Expected Output
  Dictioary = {Key:HoursWorked Value: 3.0,Key:HoursRate Value:25}
  </code></pre>