title: How to LINQ Distinct by Multiple Fields without anonymous types
body: <p>I have a table named <strong>CLASS</strong> with the Fields </p>
  
  <pre><code>    **{BATCH, DEGREE, DEPT, SEM, SECTION, GROUP }** 
  </code></pre>
  
  <p>I has the Following Records </p>
  
  <blockquote>
    <blockquote>
      <p>Record1: <strong>{ 2009 , B.E , CSE , 3Sem , ASec , 1Group }</strong></p>
      
      <p>Record2: <strong>{ 2009 , B.E , CSE , 3Sem , ASec , 2Group }</strong></p>
      
      <p>Record3: <strong>{ 2009 , B.E , ECE , 4Sem , ASec , 1Group }</strong></p>
      
      <p>Record4: <strong>{ 2009 , B.E , ECE , 4Sem , ASec , 2Group }</strong></p>
    </blockquote>
  </blockquote>
  
  <p>I Need to Select Distinct Records Ignoring the <strong>GROUP</strong> and considering only the following</p>
  
  <blockquote>
    <blockquote>
      <p><strong>{BATCH, DEGREE, DEPT, SEM, SECTION }</strong></p>
    </blockquote>
  </blockquote>
  
  <p>So it should return me the following <strong>2 Distinct Records</strong></p>
  
  <blockquote>
    <blockquote>
  <pre><code>                  Record1: **{ 2009 , B.E , CSE , 3Sem , ASec , 1Group }** 
  </code></pre>
      
      <p><strong>DistinctRecord: 1------------------------</strong>(OR)** </p>
  
  <pre><code>                  Record2: **{ 2009 , B.E , CSE , 3Sem , ASec , 2Group }**
  </code></pre>
      
      <p>-----<strong>(AND)</strong></p>
  
  <pre><code>                  Record3: **{ 2009 , B.E , ECE , 4Sem , ASec , 1Group }**
  </code></pre>
      
      <p><strong>DistinctRecord: 2</strong>------------------------<strong>(OR)</strong> </p>
  
  <pre><code>                  Record4: **{ 2009 , B.E , ECE , 4Sem , ASec , 2Group }**
  </code></pre>
    </blockquote>
  </blockquote>
  
  <p>Now i'm using the following LINQ Query</p>
  
  <pre><code>    public static object GetDistictClasses(IQueryable&lt;Class&gt; AllClasses)
      {
          return (from c in AllClasses
                  group c by new { c.Batch, c.Degree_ID, c.Specialization_ID, c.CurrentSemester, c.Section_ID } into grp
                  select new 
                  {
                      grp.Key.Batch,
                      grp.Key.Degree_ID,
                      grp.Key.Specialization_ID,
                      grp.Key.CurrentSemester,
                      grp.Key.Section_ID
                  }).Distinct();
      }
  </code></pre>
  
  <p>But it returns me a <strong>Ananymous Type</strong>, but i need the Actual <strong>Class Type</strong></p>
  
  <p>Could some one Help Me...
  thank You..</p>
  
  <p>Regrads
  Pradeep</p>