Reputation: 856
Sorry, for title... I haven't any idea how call it.
In my database I have records with dates:
2012-02-03
2012-02-03
2012-02-05
2012-02-05
2012-02-05
2012-02-06
And how make a linq query to display just records with the single dates, I mean:
2012-02-03
2012-02-05
2012-02-06
Upvotes: 3
Views: 418
Reputation: 2579
Use Distinct()
, e.g.
IEnumerable<string> distinctDates = dates.Distinct()
For more complicated cases, you may also use GroupBy(), but Distinct is enough for this
Upvotes: 5