Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 35427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:14:03+00:00 2026-05-10T14:14:03+00:00

A question that has pondered me for the last while. I am primarily a

  • 0

A question that has pondered me for the last while. I am primarily a .net developer who dabbles in Objective-C for iPhone and Mac.

How do you go about sending ‘datasets’ between methods in objective-c. For example in C# you can populate a custom class with data and pass it around in a List of type custom class. EG if you had a customer class you would just do something like:

List<Customer> customers = DataLayer.GetAllCustomers(); 

The only way I can see how this could be done in obj-c would be to populate an NSArray with custom objects? Is this an efficient way to do things? Any other recommendations? I am using sqlite as the database/data I want to return.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:14:04+00:00Added an answer on May 10, 2026 at 2:14 pm

    You’re on the right track.

    Cocoa’s collection classes — which all have mutable an immutable variants — are:

    • NSArray: ordered, can contain an object multiple times
    • NSDictionary: unordered, mapping from keys to values, keys are copied
    • NSSet: unordered, can contain an object only once
    • NSCountedSet: unordered, can contain an object multiple times

    The immutable variants help a lot with efficiency. The standard pattern for accessors of classes that have mutable variants is to copy rather than retain. This is codified in the @property mechanism, by using the copy attribute on the property:

    // Department.h @interface Department : NSObject @property (readwrite, copy) NSSet *employees; @end 

    This means that if you pass a mutable array to something that takes an array, it will be copied, and if you pass that to something else, it will be copied again. The trick is though that ‘copying’ an immutable object really just retains it, so you only take a hit for that first copy. You probably want to make a copy that first time anyway so you don’t pass a mutable array to something else, then mutate it behind the back of whatever you passed it to.

    For Cocoa on Mac OS X, I’d also strongly encourage you to take a look at Core Data. It’s an alternative to the ‘data set’ pattern you might be used to from .NET/ADO/etc. With Core Data, you don’t ‘get all customers’ and then pass that collection around. Instead you query for the customers you care about, and as you traverse relationships of the objects you’ve queried for, other objects will be pulled in for you automatically.

    Core Data also gets you features like visual modeling of your entities, automatic generation of property getters & setters, fine-grained control over migration from one schema version to another, and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 281k
  • Answers 281k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer By PreRender, you assume that most logic in the page… May 13, 2026 at 3:49 pm
  • Editorial Team
    Editorial Team added an answer It's not so hard right - the kernel half of… May 13, 2026 at 3:49 pm
  • Editorial Team
    Editorial Team added an answer I don't see anything in CollectionAssert to help, but you… May 13, 2026 at 3:49 pm

Related Questions

A line in this answer , Get used to using the Mac on its
Say I wanted to have a project, and one-to-many with to-do items, and wanted
At work, we have one of those nasty communal urinals. There is no flush
This is similar to a question that has already been asked. However, I am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.