title: How can I get the maximum value by hour in a list of object using Linq
body: <p>I have a list of custom object that have values and datetimes. If is possible to do How can I filter the object with maximum values by hours.</p>
  
  <p>So grouping the data by date and hours check the objects and get only one by hour witch has the higher value. </p>
  
  <p>For instance I have</p>
  
  <pre><code>class CustomObj
  {
    public int Id;
    public int Value;
    public DateTime Date;
  
  }
  
  List&lt;CustomObj&gt; listObj = new List&lt;CustomObj&gt;()
  
  listObj.Add(....100 elemets..)
  
  Id     Value    Date
  1      4        2014-02-06 11:41:29.507
  2      3        2014-02-06 12:11:29.510
  3      4        2014-02-06 12:41:29.510
  4      0        2014-02-06 13:11:29.510
  5      2        2014-02-06 13:41:29.510
  6      0        2014-02-06 14:11:29.510
  </code></pre>
  
  <p>So I am trying to get using linq a list that containing the items with Ids (1,3,5,6) </p>
  
  <p>Ids 1,3,5,6 means that I should have a list with the object that from the data of the  table above.
  list of custom objects as a result in a table we look like this
     Id     Value    Date
      1      4        2014-02-06 11:41:29.507
      3      4        2014-02-06 12:41:29.510
      5      2        2014-02-06 13:41:29.510
      6      0        2014-02-06 14:11:29.510</p>