Domanda

Dim months As New List(Of Date)
months = months.Distinct().ToList()

This filters very unique dates because of time difference. I want to filter dates discarding times but only considering unique elements with month and year.

È stato utile?

Soluzione

You need to take just the year and month from each date, and find the distinct values from that.

months = months.Select(Function(x) New Date(x.Year, x.Month, 1)).Distinct().ToList()
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top