static void Main(string[] args)
{
int[] xx = { 1, 4, 4, 4, 6, 6, 8, 76, 7, 4 };
List<int> l = xx.ToList<int>();
l.Sort();
var query = (from q in l
select q).Distinct();
for (int i = query.Count() - 1; i > 0; i--)
{
Console.Write(query.ElementAt(i) + " , ");
}
Console.Read();
}
对int数组进行从大到小的排序,并去除重复项
最新推荐文章于 2024-07-02 16:02:25 发布
本文介绍了一个使用C#进行数组操作的例子,其中包括将数组转换为列表、对列表进行排序并去除重复元素的过程。此外,还展示了如何利用LINQ进行数据查询,并按特定顺序输出结果。
3231

被折叠的 条评论
为什么被折叠?



