title: How to calculate count on of table column using group by clause in linq
body: <p>I'm new to linq.
  In c# I'm doing as follows to get the count of one column.</p>
  
  <pre><code>SELECT   DispatcherName,
           ActivityType,
           CONVERT(BIGINT,COUNT(ActivityType)) AS Total
  FROM     ACTIVITYLOG
  GROUP BY DispatcherName,
           ActivityType
  ORDER BY Total DESC
  </code></pre>
  
  <p>Can any one tell m,how I can achieve the same thing using LINQ.</p>
  
  <p>Update:</p>
  
  <p>HI I did as follows and got the reslut.
  But I'm not able to convert result to datatable.
  this is how I did.
  here dt is datatabe with two columns Dispatchername and ActivityType.</p>
  
  <pre><code> var query1 = from p in dt.AsEnumerable()
                               group p by new
                               {
                                   DispatcherName = p.Field&lt;string&gt;("Dispatchername"),
                                   Activity = p.Field&lt;string&gt;("ActivityType"),
                               }
                                   into pgroup
                                   let count = pgroup.Count()
                                   orderby count
                                   select new
                                   {
                                       Count = count,
                                       DispatcherName = pgroup.Key.DispatcherName,
                                       Activity = pgroup.Key.Activity
                                   };
  </code></pre>
  
  <p>pls help me out asap.</p>