How do I get the Nth largest element from a list with duplicates, using LINQ?
问题 I've seen in various StackOverflow answers that I can get the Nth largest element in a list by doing something like var nthFromTop = items.OrderByDescending().Skip(N-1).First(); But wouldn't this only work if there are no duplicates in the list? If the list contains duplicates, is there a way to get the Nth largest element (or set of elements) using LINQ? If not, what would be the most efficient way to do this in C#? 回答1: To get the set of all items equal to the Nth largest item you'll need