HashSet (C#)

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:00 AM on 8/14/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

HashSet

A generic collection in System.Collections.Generic that stores unique elements and provides efficient membership testing and set-based operations. Domain: C# → .NET → System.Collections.Generic → Sets

2
New cards

T in HashSet

The generic type parameter that specifies the type of elements stored in the HashSet.

3
New cards

new HashSet()

Creates an empty HashSet using the default equality comparer for T.

4
New cards

new HashSet(collection)

Creates a HashSet initialized with the unique elements from the specified collection.

5
New cards

new HashSet(comparer)

Creates an empty HashSet that uses the specified equality comparer to determine whether elements are equal.

6
New cards

HashSet Initializer

Syntax that creates a HashSet and supplies its initial elements inside braces.

7
New cards

set.Count

Gets the number of unique elements currently contained in the HashSet.

8
New cards

set.Add(item)

Attempts to add an element to the HashSet and returns true if the element was added or false if an equivalent element was already present.

9
New cards

set.Remove(item)

Attempts to remove the specified element and returns whether the element was found and removed.

10
New cards

set.Contains(item)

Determines whether the HashSet contains an element equivalent to the specified item.

11
New cards

set.Clear()

Removes all elements from the HashSet.

12
New cards

HashSet Uniqueness

A HashSet stores at most one element from each equality-equivalent group; attempts to add an equivalent duplicate do not create another entry.

13
New cards

HashSet Equality Comparer

The comparer used by a HashSet to determine whether two elements should be treated as equal.

14
New cards

set.Comparer

Gets the IEqualityComparer used to determine element equality within the HashSet.

15
New cards

set.UnionWith(other)

Modifies the current HashSet so that it contains every element present in either the current set or the specified collection.

16
New cards

set.IntersectWith(other)

Modifies the current HashSet so that it contains only elements present in both the current set and the specified collection.

17
New cards

set.ExceptWith(other)

Modifies the current HashSet by removing elements that also occur in the specified collection.

18
New cards

set.SymmetricExceptWith(other)

Modifies the current HashSet so that it contains elements present in either set but not in both.

19
New cards

set.IsSubsetOf(other)

Determines whether every element in the current HashSet is contained in the specified collection.

20
New cards

set.IsProperSubsetOf(other)

Determines whether the current HashSet is a subset of the specified collection and the specified collection contains at least one additional element.

21
New cards

set.IsSupersetOf(other)

Determines whether the current HashSet contains every element in the specified collection.

22
New cards

set.IsProperSupersetOf(other)

Determines whether the current HashSet is a superset of the specified collection and contains at least one additional element.

23
New cards

set.SetEquals(other)

Determines whether the current HashSet and the specified collection contain the same elements.

24
New cards

set.Overlaps(other)

Determines whether the current HashSet and specified collection share at least one common element.

25
New cards

HashSet vs List

List is an ordered, index-accessible collection that permits duplicates, whereas HashSet focuses on unique elements and membership rather than positional indexing.