"Chris Mullins [MVP]" <cm******@yahoo.comwrote in message
news:OK****************@TK2MSFTNGP06.phx.gbl...
"Muffin" <mu****@NoEmail.localwrote:
>>Does C# have a Set Collection class/functions of some sort? I can not seem
to find it.
What you're looking for can be found here:
http://msdn2.microsoft.com/en-us/lib...75(vs.80).aspx
Which contains:
C++, C#, Visual Basic .NET, and Java don't provide inherent language
features for working
with sets. If you want to use sets, you need to create your own set
class with the appropriate methods,
properties, and logic.
A strange thing to say, since Java has included a Set interface and a
collection of Set implementations since JDK 1.2. (Not an "inherent language
feature", but there's no need to "create your own".)
In fact, Java implements Sets on top of Maps using a straightforward pattern
that could easily be used in .NET to create a Set on top of Hashtable:
1.Create a Set class that has a field that is a Map.
2. Conceptually, define membership in the Set as being a key in the Map..
3. To add an object O to the Set, add the mapping (O, Map) to the Map.
4. To remove O from the Set, remove that mapping from the Map.
5. To check whether O is in the Set, check whether the Map contains the key
O
etc.