I have a hash set as :
HashSet<String> hash ;
and a list as:
IList<String> names = new List<String>(){"ABC","DEF"};
I want to concat hash and names; then store the result in same variable i.e. hash.
What is the best approach to do this since I have arround 10k records to store in HashSet?
Use UnionWith
:
Modifies the current HashSet object to contain all elements that are present in itself, the specified collection, or both.
hash.UnionWith(names);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With