Junior Collections

What is the difference between Add() and Contains() in a HashSet<T>?

Method Purpose Return Value

Add(item) Adds item if not already present true if added, false if

duplicate

Contains(it

em)

Checks if item exists in the set true if found, false

otherwise

More from C# Programming Tutorial

All questions for this course