title: Using DateTime.Quarter in LinQ Group
body: <p>I need to group by quarter in a LinQ expression. here is the code with year:</p>
  
  <pre><code>temp = rmds.GroupBy(a =&gt; new { a.reportinggroup, a.timestep.Year })
             .Select(g =&gt; ....}).ToList();
  </code></pre>
  
  <p>Now I would like to replace <code>DateTime.Year</code> in the GroupBy with a quarter expression. Here is my extension mehtod:</p>
  
  <pre><code>public static int quarter(this DateTime @this)
  {
      return (int) Math.Ceiling((double)@this.Month / 3);
  } 
  </code></pre>
  
  <p>But if I replace this in my LinQ:</p>
  
  <pre><code> temp = rmds.GroupBy(a =&gt; new { a.reportinggroup, a.timestep.quarter() });
  </code></pre>
  
  <p>I get following error: </p>
  
  <blockquote>
    <p>Error 1 Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access. </p>
  </blockquote>
  
  <p>Why? What do I need to use to group by quarter please?</p>