Thursday, May 14, 2009

HashSet New Collection Added in C# 3.5

In C# 3.5 there is new collection datataype added named HashSet.HashSet is designed to suppost mathamatical Calculations like Union, Intersection, IsSubsetOf, IsSupersetOf.
Hashable Conains Unique values.
eg.

HashSet hst = new HashSet();
hst.Add(1);
hst.Add(2);
hst.Add(2);
hst.Add(2);
hst.Add(2);
hst.Add(3);


Response.Write("count="+Count);

above example will Print count=3. because HashSe Contains Only three unique elements.

HashSet is Faster than IList in many ways.

To knwo more feature of HashSe Visit..

http://www.vcskicks.com/hashset.php
and
http://msdn.microsoft.com/en-us/library/bb495294.aspx

Thanks.