How to get HashSet size 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(hset.Count);   
    }
}
  
  
  
  
/*
run:
    
5
    
*/

 



answered Feb 7, 2024 by avibootz

Related questions

1 answer 224 views
224 views asked Oct 30, 2022 by avibootz
1 answer 215 views
215 views asked Feb 16, 2021 by avibootz
1 answer 272 views
272 views asked Sep 26, 2016 by avibootz
1 answer 217 views
217 views asked Mar 9, 2023 by avibootz
1 answer 236 views
236 views asked Jul 18, 2022 by avibootz
2 answers 293 views
...