PC Review


Reply
Thread Tools Rate Thread

Dictionary<K,V>

 
 
Tony
Guest
Posts: n/a
 
      18th Jun 2008
Hello!

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

//Tony


 
Reply With Quote
 
 
 
 
Kerem Gümrükcü
Guest
Posts: n/a
 
      18th Jun 2008
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Hello!
>
> When you are using a Dictionary object what type is to possible to have on
> the key?
>
> //Tony
>
>



 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 8:31 am, "Tony" <johansson.anders...@telia.com> wrote:
> 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
 
Reply With Quote
 
Tony
Guest
Posts: n/a
 
      18th Jun 2008
Hello!

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

//Tony

"Kerem Gümrükcü" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
> > Hello!
> >
> > When you are using a Dictionary object what type is to possible to have

on
> > the key?
> >
> > //Tony
> >
> >

>
>



 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 8:44*am, "Tony" <johansson.anders...@telia.com> wrote:
> 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
 
Reply With Quote
 
Duggi
Guest
Posts: n/a
 
      18th Jun 2008
On Jun 18, 12:44*pm, "Tony" <johansson.anders...@telia.com> wrote:
> Hello!
>
> But how is that done if a class is used as a key?
>
> //Tony
>
> "Kerem Gümrükcü" <kareem...@hotmail.com> skrev i meddelandetnews:(E-Mail Removed)...
>
>
>
> > 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.com> schrieb im Newsbeitrag
> >news:(E-Mail Removed)...
> > > 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.
 
Reply With Quote
 
Registered User
Guest
Posts: n/a
 
      18th Jun 2008
On Wed, 18 Jun 2008 02:57:34 -0700 (PDT), Duggi
<(E-Mail Removed)> wrote:

>On Jun 18, 12:44*pm, "Tony" <johansson.anders...@telia.com> wrote:
>> Hello!
>>
>> But how is that done if a class is used as a key?
>>

Do you mean class as in typeof(someClass)?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dictionary<TKey,TValue> as a Dictionary key in C# 2.0 dox Microsoft Dot NET 5 19th Mar 2008 02:15 PM
Change the dictionary to Collins Gage Canadian Dictionary Adri Microsoft Word Document Management 2 15th Mar 2008 05:18 PM
How can I make Word use the UK dictionary not the US dictionary Alison Microsoft Word Document Management 2 20th Dec 2007 01:32 PM
frontpage default dictionary vscustom dictionary and location =?Utf-8?B?RGVsdGFHYW1tYQ==?= Microsoft Frontpage 12 16th Oct 2004 07:05 PM
Can I use a main dictionary in Word 2003 and not custo dictionary? =?Utf-8?B?UmFuag==?= Microsoft Word Document Management 1 28th Aug 2004 05:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:08 AM.