Re: What's the Real Story on Keys for NSDictionary
Re: What's the Real Story on Keys for NSDictionary
- Subject: Re: What's the Real Story on Keys for NSDictionary
- From: Ondra Cada <email@hidden>
- Date: Mon, 28 Jan 2002 20:21:33 +0100
Chris,
>
>>>>> Chris Gehlker (CG) wrote at Mon, 28 Jan 2002 11:21:09 -0700:
CG> The docs say that any class that implements NSCopying can provide keys
CG> for NSDictionary. Hillegass says the keys must be NSString. I've had bad
CG> luck with anything that should work, like NSNumber. So are they docs just
CG> wrong here?
You need NSCopying and reasonable hash. With that, it *always* worked for me
well. Beside NSNumbers I've used small arrays and dictionaries (witch
re-implemented hash) as keys as well, and couple of times my own objects too.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc