Skip to main content

Hash Sets

warning

This document has been translated using machine translation without human review.

How to make AddRange in HashSet<T>?

To add multiple elements to HashSet<T>, you can use the UnionWith method:

var hashSet = new HashSet<string>();
var arr = ["hello", "world", "!"];

hashSet.UnionWith(arr);