Difference between HashSet.IsSuperSetOf and IsProperSuperSetOf?
A superset of set A
is a set that contains all of the elements of set A
A proper superset of A
is a set that contains all of the elements of A
but is not equal to A
.
So if A
= {1,2,3}
, then {1,2,3}
is a superset of A
but not a proper superset, while {1,2,3,4}
is a proper superset.
You can think of it like the difference between >
and >=
. IsSuperSetOf is doing something like >=
, so your set could have exactly the same elements that are in the set you're comparing to. By contrast, a proper super set is kind of like >
and has extra elements that the second set doesn't have.
For example, a set is a superset of itself, but it's not a proper superset of itself.