patterncsharpCritical
Is there an AddRange equivalent for a HashSet in C#
Viewed 0 times
hashsetforequivalentaddrangethere
Problem
With a list you can do:
There is no add range method in a
What is the best way to add another
list.AddRange(otherCollection);There is no add range method in a
HashSet.What is the best way to add another
ICollection to a HashSet?Solution
For
This is to indicate the distinct way the
I think that
HashSet, the name is UnionWith.This is to indicate the distinct way the
HashSet works. You cannot safely Add a set of random elements to it like in Collections, some elements may naturally evaporate.I think that
UnionWith takes its name after "merging with another HashSet", however, there's an overload for IEnumerable too.Context
Stack Overflow Q#15267034, score: 882
Revisions (0)
No revisions yet.