| I implemented a class called MyDictionary that inherits from
DictionaryBase.
| The thing is that my class, cannot handle a duplicate value in the "keys"
Have you tried inheriting from
System.Collections.Specialized.NameValueCollection ?
http://msdn.microsoft.com/library/de...classtopic.asp
Unfortunately it wants strings & not objects.
You could code your Add such that if you are adding a duplicate that it
changes that entry to a list and adds the duplicates to the list.
Unfortunately this complicates the indexer's & enumerators as sometimes you
are returning a single object, sometimes multiple objects.
Have you considered defining MyDictionary to be a dictionary of an array of
your objects? Where each key holds an array (ArrayList?) of one or more
objects?
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Mike" <mi**@hitnext.com> wrote in message
news:OF**************@tk2msftngp13.phx.gbl...
| Hello guys, how are you?
|
|
|
| I implemented a class called MyDictionary that inherits from
DictionaryBase.
|
| The thing is that my class, cannot handle a duplicate value in the "keys"
|
|
|
| Like;
|
|
|
| Dim md as New MyDictionary
|
| md.add("Mike", Object1)
|
| md.add("Mike", Object2)
|
|
|
| This will generate an error during compilation, because I cannot add Mike
| two times to the collection, we all know that.
|
| I need to come up with something (like a custom made collection or
| structure) that allow me to do this.
|
| I need a key (string type, can be duplicate) and a value (object type,
like
| an instance of another class).
|
|
|
| Could you please help me on this, any example will be highly appreciated!
|
|
|
| Mike
|
|