How to initialize HashSet in C#

1 Answer

0 votes
using System;
using System.Collections.Generic;
 
public class Program
{
    public static void Main(string[] args)
    {
        HashSet<string> hset = new HashSet<string> {"c#", "vb.net", "c", "c++", "python"};
 
        Console.WriteLine(string.Join(" ", hset));   
    }
}
 
 
 
 
/*
run:
   
c# vb.net c c++ python
   
*/

 



answered Jul 18, 2022 by avibootz

Related questions

2 answers 296 views
2 answers 261 views
1 answer 228 views
228 views asked Jul 18, 2022 by avibootz
1 answer 220 views
2 answers 355 views
1 answer 251 views
251 views asked Feb 16, 2021 by avibootz
1 answer 263 views
...