I have a List(Of DateTime) items. How can I check if all the items are the same with a LINQ query? At any given time there could be 1, 2, 20, 50 or 100 items in the list.
Thanks
Like this:
if (list.Distinct().Skip(1).Any())
Or
if (list.Any(o => o != list[0]))
(which is probably faster)
2.1m questions
2.1m answers
60 comments
57.0k users