Hi folks,
I have a class derived from Dictionary. I need this class to simulate a HashSet, because Silverlight doesn't know HashSets and my classes make heavy use of HashSets. So I decided to exchange the HashSet with Dictionary. To further use my classes with all the HashSet-Objects, I try to make a custom HashSet class, that is derived from Dictionary and override all the relavant methods like the Add-method:
class HashSet<T> : Dictionary<T, object>
{
public override void Add(T element)
{
base.Add(element, null);
}
}
Now I need to enable the foreach-loop for my new HashSet-class. Obviously, my class returns a KeyValuePair in a foreach-loop, but I need T as return type. Can anyone tell me, what and how I need to override the Dictionary base class?
Thanks in advance, Frank