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

  • SEARCH
  • Home
  • 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

Related Questions

C# question (.net 3.5). I have a class, ImageData, that has a field ushort[,]
I notice that StackOverflow has a views count for each question and that these
Question Can I build a image database/library that has an e-commerce style checkout system
Edit: From another question I provided an answer that has links to a lot
Question: Is it possible to construct a web page that has a script to
I think the answer to this question is so obivous that noone has bothered
From a previous question I have seen that the CLR has workstation and server
This has been asked before (question no. 308581) , but that particular question and
Really my question has more to do with the server-side scrubbing of html that's
Please forgive a question that has been addressed in some form or fashion previously.

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.