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 165 views
2 answers 146 views
1 answer 144 views
144 views asked Jul 18, 2022 by avibootz
1 answer 132 views
2 answers 242 views
1 answer 168 views
168 views asked Feb 16, 2021 by avibootz
1 answer 176 views
...