title: Linq - group by multiple column not working, lambda syntax
body: <p>I am trying to group 7 objects (of Type ABPM) by date and hour and not getting correct results. </p>
  
  <pre><code>Private Class ABPM
      Public DT As Date = Date.Now
      Public Hour As Integer = 0
      Public Minute As Integer = 0
      Public SBP As Integer = 0
      Public DBP As Integer = 0
  End Class
  
  Dim abpms As New List(Of ABPM)
  </code></pre>
  
  <p><a href="http://imgur.com/2nMbCwb" rel="nofollow">The data in the list is here</a></p>
  
  <p>The following query produces 7 groups instead of 2</p>
  
  <pre><code>Dim hourlyDayGroup2 = abpms.GroupBy(Function(a As ABPM) New With {a.DT, a.Hour})
  </code></pre>
  
  <p>But this one (without lambda) outputs only 2 group which is correct</p>
  
  <pre><code>Dim hourlyDayGroup = From a As ABPM In abpms _
                           Group By a.DT, a.Hour Into Group
  </code></pre>
  
  <p>What is the correct way to write the lambda query? Thanks</p>