group by average on a list of objects in C# <p>I have a list of objects where object looks like below</p> <pre><code>public class Sample { public DateTime _dt; public decimal _d; public decimal_value; } </code></pre> <p>I want a list grouped by year and month of a date and _d values with _value averaged.</p> <p>So if for month Jan, list has </p> <pre><code>one set of 31 values with _d =1, one set of 31 values with _d =5 </code></pre> <p>result list of Sample will have two values </p> <pre><code>1/1/2016 ,_d = 1 and average of _value 1/1/2016 ,_d = 5 and average of _value </code></pre>