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 290 views
2 answers 258 views
1 answer 224 views
224 views asked Jul 18, 2022 by avibootz
1 answer 216 views
2 answers 351 views
1 answer 248 views
248 views asked Feb 16, 2021 by avibootz
1 answer 256 views
...