• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(Newb) Populate NSMutableDictioanry with NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(Newb) Populate NSMutableDictioanry with NSArray


  • Subject: (Newb) Populate NSMutableDictioanry with NSArray
  • From: Jon Davis <email@hidden>
  • Date: Sun, 31 Aug 2008 01:34:05 -0700

I came across tutorial code that looked sort of like this:

NSMutableDictionary * myCollection;
myCollection = [[NSArray alloc] initWithObjects:@"a", @"b", @"c", nil];

The types are not the same. So my first question is, is this a bug? And if so, why didn't the compiler catch it? I come from C# so unless NSMutableDictionary inherits NSArray this logic would not compile.

If it is not a bug, can someone confirm that NSDictionary is not just used for key/value pairs but as simple list types, too? Otherwise, why would myCollection above be declared as an NSMutableDictionary?

Thanks,
Jon

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: (Newb) Populate NSMutableDictioanry with NSArray
      • From: "Michael Ash" <email@hidden>
    • Re: (Newb) Populate NSMutableDictioanry with NSArray
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Subclassing NSCoder
  • Next by Date: Trouble with Scripting Bridge
  • Previous by thread: Re: Problem with NSUserDefaultsController
  • Next by thread: Re: (Newb) Populate NSMutableDictioanry with NSArray
  • Index(es):
    • Date
    • Thread