title: get sum from list of objects in linq C#
body: <p>I have list of objects as described below:</p>
  
  <pre><code>List&lt;Maths&gt; mObjs = new List&lt;Maths&gt;();
  mObjs.Add(new Maths{ Name = "Jack", M1 = 10, M2 = 5, M3 = 0, M4 = 2, M5 =1 });
  mObjs.Add(new Maths { Name = "Jill", M1 = 2, M2 = 3, M3 = 4, M4 = 1, M5 = 0 });
  mObjs.Add(new Maths { Name = "Michel", M1 = 12, M2 = 15, M3 = 10, M4 = 12, M5 = 11 });
  </code></pre>
  
  <p>Now I need to calculated the total aggregated value for all three people.
  I need to get the below results, probably a new other class</p>
  
  <pre><code>List&lt;Results&gt; mRes = new List&lt;Results&gt;();
  
  public class Results{
      public string Name { get; set; }
      public int TotalValue { get; set; }
  
  }
  
  mRes.Name = "M1"
  mRes.TotalValue  = 24;
  
  mRes.Name = "M2"
  mRes.TotalValue  = 23;
  
  mRes.Name = "M3"
  mRes.TotalValue  = 14;
  
  mRes.Name = "M4"
  mRes.TotalValue  = 15;
  
  
  mRes.Name = "M5"
  mRes.TotalValue  = 12;
  </code></pre>
  
  <p>How can I get this data from mObjs using linq query? I know we can do it using for, but want to know if there are any better ways to get this using linq query because that reduces lines of code and I have similar requirements in many other places and dont want to write number of foreach or fors every time.</p>