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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:21:22+00:00 2026-05-26T12:21:22+00:00

What I want is the ability to store name,object pairs. Unlike objC c#’s Dictionary

  • 0

What I want is the ability to store name,object pairs.

Unlike objC c#’s Dictionary requires types. In objC I would use id to mean “any object”.

How would I manage this in c#.

So what I’m looking for is:

Dictionary<String,id>.

Sorry if this is really basic!

  • 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-26T12:21:22+00:00Added an answer on May 26, 2026 at 12:21 pm

    Without going into a lot of faffery to talk to multiple strongly typed lists of objects, the simplest way to achieve this is with a Dictionary<string, object> and to cast out your object type as you need it:

    int i = (int)myDictionary["Age"];
    string n = (string)myDictionary["Name"];
    

    There are a few dynamic options here such as ExpandoObject:

    http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject.aspx

    If you go the object dictionary approach, pay attention to boxing on value types. Using the dynamic approach won’t have the boxing implications, but will require runtime resolution, so performance again is slightly impacted.

    Nothing comes for free, but by and large you shouldn’t see the effects of this minor overhead.

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

Sidebar

Related Questions

I want to store code similar to how jsfiddle stores code. I currently use
In Java, we can always use an array to store object reference. Then we
I want to ability to select code from my program such as dreamweaver or
I'm building an NSPredicateEditor , and I want the ability to do advanced date
I want to provide the ability to save some rendered data/charts (with the titles
I want to give my users the ability to choose how their public page
The marketing people want to have the ability to write direct inline HTML in
I have a tree control and I want to give the user the ability
Say you have an app, that you want to provide users ability to browse
I want to introduce the ability for the my core-data app to download a

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.