using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 去重
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[] { 1, 1, 2, 2, 3 };
var a = arr.Distinct();
foreach (var item in a)
{
Console.WriteLine(item);
}
Console.ReadLine();
//HashSet<int> hs = new HashSet<int>(arr);
//arr = hs.ToArray();
//foreach (var item in arr)
//{
// Console.WriteLine(item);
//}
//Console.ReadLine();
}
}
}
c#数组去重
最新推荐文章于 2024-01-28 01:08:05 发布