Get N max numbers and their corresponding position(index) from a 2D array double[,] using lambda expression
问题 This is a question similar to [ Get N max numbers from a List<int> using lambda expression ] But I want to learn if I want to keep the index of those N max numbers, how should I write it using lambda expression. Example) List<int> numbers = new List<int> { 12, 5, -8, 4, 7, 28, 3, 22 }; How can we get 4 maximum numbers by lambda: {28, 22, 12, 7} plus indexes { 5, 7, 0, 4} as kirill suggested: var result = numbers.OrderByDescending(n => n).Take(4); but how can I get the index of those N max