Apache License 2.0
An implementation of HashSet class in .NET that can be used in .NET Compact Framework (.NET CF), in which it is natively missing
Examples of basic usage of a HashSet(Of String):
Initialize a HashSet(Of String):
Dim strHs = New HashSet(Of String)
Assert.AreEqual(strHs.Count, 0)
Add an element:
Dim strHs = New HashSet(Of String)
strHs.Add("first")
Assert.IsTrue(strHs.Contains("first"))
Remove an element:
Dim strHs = New HashSet(Of String)
strHs.Add("first")
strHs.Remove("first")
Assert.IsFalse(strHs.Contains("first"))
Clear elements:
Dim strHs = New HashSet(Of String)
strHs.Add("first")
strHs.Add("second")
strHs.Add("third")
Assert.AreEqual(strHs.Count, 3)
strHs.Clear()
Assert.AreEqual(strHs.Count, 0)
Compare HashSets
Dim strHs1 = New HashSet(Of String)
strHs1.Add("first")
strHs1.Add("second")
strHs1.Add("third")
Dim strHs2 = New HashSet(Of String)(strHs1)
Assert.IsTrue(strHs1 = strHs2)
strHs2.Remove("second")
Assert.IsTrue(strHs1 <> strHs2)
This library and associated unit tests were developed in VS 2008 as Smart Device projects.
Author: Albert Ho <albertho -at- kdsecure.com>
Copyright: (c) 2010 by KD Secure, LLC
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.