Get MAX date per day and return all rows with those dates
<p>I have a table that has a datetime field. There are multiple rows with various,sometimes identical, dates.</p>

<p>I am trying to find a LINQ query that can return to me an IList of ALL entries over the last <em>n</em> days, but for each day of rows returned, I should only see the rows from the MAX time.</p>

<p>e.g. if I have rows in a day with times of 4/4/16 1:00:00 and 4/4/16 2:00:00, I would expect to retrieve all rows with the latter date.</p>

<p>Additional clarification:</p>

<p>The entity has an attribute, let's say Category.  I want the query to return ONE IList, that is populated with every entity sorted by max date PER DAY and PER CATEGORY.  e.g.</p>

<pre><code>Item1 | Category1 | 10/10/2016 11:00:00
Item1 | Category1 | 10/10/2016 11:00:00
Item1 | Category1 | 10/10/2016 11:00:00
Item1 | Category2 | 10/10/2016 11:00:05
Item1 | Category1 | 10/10/2016 11:00:05
Item1 | Category1 | 10/10/2016 11:00:05
Item1 | Category2 | 10/11/2016 11:00:00
Item1 | Category1 | 10/11/2016 11:00:00
</code></pre>

<p>I would expect the result to look like a list of:</p>

<pre><code>Item1 | Category2 | 10/10/2016 11:00:05
Item1 | Category1 | 10/10/2016 11:00:05
Item1 | Category1 | 10/10/2016 11:00:05
Item1 | Category2 | 10/11/2016 11:00:00
Item1 | Category1 | 10/11/2016 11:00:00
</code></pre>