寻找前n个数的方法

xiaoxiao2021-02-28  113

int[] array = new int[] { 1, 3, 7,7,7 ,9, 2, 14 };//需求找出最大的前3个数             List<int> result = array.Where(p => array.OrderByDescending(o => o).Take(3).ToList().Contains(p)).ToList();                          Console.ReadKey();
转载请注明原文地址: https://www.6miu.com/read-49904.html

最新回复(0)