c#-HashSet

 static void Main(string[] args)
      {
        string[] cities = new string[] 
        {
            "Delhi" , "Kolkata",
            "New York" , "London",
            "Tokyo" , "Washington",
            "Tokyo"
        };
        HashSet<string> hashSet = new HashSet<string>(cities);
        foreach (var city in hashSet)
        {
            Console.WriteLine(city);
        }

 
      }

结果是去重后的。

posted @ 2023-04-12 09:22  vba是最好的语言  阅读(22)  评论(0编辑  收藏  举报