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 3423112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:19:00+00:00 2026-05-18T06:19:00+00:00

here’s what i’m trying to convert to objective c from c#: public class Television

  • 0

here’s what i’m trying to convert to objective c from c#:

public class Television
{
     public string Name {get; set};
     public bool isOn {get; set};
     public int channelNum {get; set};
     public string channelName {get; set};
}

let’s say the television fairy has been to my house, and i don’t know how many televisions are in there. or, i want to make this code reusable and since everyone has a different amount of televisions in their households, i want to make this a different number at every runtime.

 public List<Television> TVs = new List<Television>(4);

when i want to i can say:

 TVs[3].channelNum = 34;
  1. in objective c, how would you put this in an array/dictionary(hashtable)? can you give me an example?
  2. if i created a new object every time a new Television is put in the house, and accessed its properties, is this more efficient on memory than a list class would be? it seems like a list would be easier than creating 4 array sets, wouldn’t it?
  3. could someone give me an example of how this would be used if i called

    Television TVs = [[Television alloc]init];

    and used properties instead?

  4. could i use television objects in an nsmutablearray, and just pull them out to access their properties when i need them, or when they change?

  • 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. Editorial Team
    Editorial Team
    2026-05-18T06:19:01+00:00Added an answer on May 18, 2026 at 6:19 am

    Just something to give you an idea (though it’s not very lovely code)…

    @interface Television : NSObject {
    @private
        NSString *name;
        BOOL isOn;
        int channelNumber;
        NSString *channelName;
    }
    @property (nonatomic, copy) NSString *name;
    @property (nonatomic, assign, getter=isOn) BOOL on;
    @property (nonatomic, assign) int channelNumber;
    @property (nonatomic, copy) NSString* channelName;
    @end
    

    Implemenation

    @implementation Television
    @synthesize name, on=isOn, channelNumber, channelName;
    @end
    

    Usage

    Television *tv1 = [[[Television alloc] init] autorelease];
    tv1.name = @"TV Name";
    tv1.on = YES;
    tv1.channelNumber = 236;
    tv1.channelName = "Channel 236";
    
    // create a mutable array to use as a list
    NSMutableArray *array = [NSMutableArray array];
    
    // add tv1 to the array
    [array addObject:tv1];
    
    // add another one
    [array addObject:[[[Television alloc] init] autorelease]];
    [array objectAtIndex:1].name = @"Another name";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is what I am trying to achieve in PHP: I have this string:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here's what I'm trying to accomplish with this program: a recursive method that checks
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here is my query: select word_id, count(sentence_id) from sentence_word group by word_id having count(sentence_id)
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:

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.