Use Recursion to Clear out Textboxes: Table 1: Compare Results of Different HashSet Operations.

System.Collections.Generic.List<T> and System.Collections.Generic.HashSet<T> both support the IEnumerable<T> extension methods and participate in LINQ queries. HashSet<T> includes methods not included in List<T>. Note that the comparison does not depend on the order of the items.

list1 and hashSet1 list2 and hashSet2 List Operation Result
{1,2,3} {3,2,1} list1.SequenceEqual(list2)
hashSet1.SetEquals(hashSet2)
hashSet1.IsSubSet(hashSet2)
hashSet1.IsProperSubSet(hashSet2)
False
True
True
False
{1,2,3} {2,4,5} hashSet1.ExceptWith(hashSet2)
hashSet1.SymmetricExceptWith(hashSet2)
{1, 3}
{1, 3, 4, 5}
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.