By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,675 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,675 IT Pros & Developers. It's quick & easy.

Collection

P: n/a
Hi guys;

I created a class that inherits from DictionaryBase class.
The thing is that I want to allow the user when using my class to enter
duplicate keys in the collection like;

Dim myCl as new MyDictionary
myCl.Dictionary.Add("Mike", AnObject)
myCl.Dictionary.Add("Mike", AnObject2)
myCl.Dictionary.Add("Mike", AnObject3)

how can I achieve this inhering from DictionaryBase?

Thanks guys!
Jan 6 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Mike,

I think that all of the .Net key-value collections require unique, non-null
keys.

Kerry Moorman
"Mike" wrote:
Hi guys;

I created a class that inherits from DictionaryBase class.
The thing is that I want to allow the user when using my class to enter
duplicate keys in the collection like;

Dim myCl as new MyDictionary
myCl.Dictionary.Add("Mike", AnObject)
myCl.Dictionary.Add("Mike", AnObject2)
myCl.Dictionary.Add("Mike", AnObject3)

how can I achieve this inhering from DictionaryBase?

Thanks guys!

Jan 6 '06 #2

P: n/a
"Kerry Moorman" <Ke**********@discussions.microsoft.com> schrieb:
I think that all of the .Net key-value collections require unique,
non-null
keys.


Exception: The 'NamedValueCollection' which store all values for a certain
key in a single string. However, this is not a very flexible solution.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 7 '06 #3

P: n/a


maybe i am thinking to simplistic here :-)

but why don`t you just add the objects to a object array and store them
under one name in the dictionary

regards

Michel Posseth [MCP]


"Mike" <mi**@hitnext.com> wrote in message
news:uR**************@TK2MSFTNGP09.phx.gbl...
Hi guys;

I created a class that inherits from DictionaryBase class.
The thing is that I want to allow the user when using my class to enter
duplicate keys in the collection like;

Dim myCl as new MyDictionary
myCl.Dictionary.Add("Mike", AnObject)
myCl.Dictionary.Add("Mike", AnObject2)
myCl.Dictionary.Add("Mike", AnObject3)

how can I achieve this inhering from DictionaryBase?

Thanks guys!

Jan 8 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.