471,325 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Dictionary<K,V>

Hello!

When you are using a Dictionary object what type is to possible to have on
the key?

//Tony
Jun 27 '08 #1
6 1292
Hi Toni,
>When you are using a Dictionary object what type is to possible to have on
the key?
AFIK any!
Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Tony" <jo*****************@telia.comschrieb im Newsbeitrag
news:ul**************@TK2MSFTNGP02.phx.gbl...
Hello!

When you are using a Dictionary object what type is to possible to have on
the key?

//Tony


Jun 27 '08 #2
On Jun 18, 8:31 am, "Tony" <johansson.anders...@telia.comwrote:
When you are using a Dictionary object what type is to possible to have on
the key?
Anything. If it's a reference type and doesn't override Equals/
GetHashCode then you'll only get an identity look-up (unless you
specify a separate IEqualityComparer), and it's generally a bad idea
to use mutable types as keys, but that's it really.

Jon
Jun 27 '08 #3
Hello!

But how is that done if a class is used as a key?

//Tony

"Kerem Gümrükcü" <ka*******@hotmail.comskrev i meddelandet
news:Oe**************@TK2MSFTNGP05.phx.gbl...
Hi Toni,
When you are using a Dictionary object what type is to possible to have
on
the key?

AFIK any!
Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Tony" <jo*****************@telia.comschrieb im Newsbeitrag
news:ul**************@TK2MSFTNGP02.phx.gbl...
Hello!

When you are using a Dictionary object what type is to possible to have
on
the key?

//Tony


Jun 27 '08 #4
On Jun 18, 8:44*am, "Tony" <johansson.anders...@telia.comwrote:
But how is that done if a class is used as a key?
What do you mean? Why would you expect it not to work?

Jon
Jun 27 '08 #5
On Jun 18, 12:44*pm, "Tony" <johansson.anders...@telia.comwrote:
Hello!

But how is that done if a class is used as a key?

//Tony

"Kerem Gümrükcü" <kareem...@hotmail.comskrev i meddelandetnews:Oe**************@TK2MSFTNGP05.phx. gbl...
Hi Toni,
>When you are using a Dictionary object what type is to possible to have
on
>the key?
AFIK any!
Regards
Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space:http://kerem-g.spaces.live.com/
Latest Open-Source Projects:http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Tony" <johansson.anders...@telia.comschrieb im Newsbeitrag
news:ul**************@TK2MSFTNGP02.phx.gbl...
Hello!
When you are using a Dictionary object what type is to possible to have
on
the key?
//Tony- Hide quoted text -

- Show quoted text -
Dictionary allows object as key, I think while retrieving the value
from dictionary, it uses HashCode of the object.

Anything fishey or you are expecting a BUG in baseclass library?

-Cnu.
Jun 27 '08 #6
On Wed, 18 Jun 2008 02:57:34 -0700 (PDT), Duggi
<Du***************@gmail.comwrote:
>On Jun 18, 12:44*pm, "Tony" <johansson.anders...@telia.comwrote:
>Hello!

But how is that done if a class is used as a key?
Do you mean class as in typeof(someClass)?

Jun 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Andrew Robinson | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.