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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:05:15+00:00 2026-05-14T09:05:15+00:00

Can you do array[‘Name’]; In C# Rather than: array[0]; I know you can do

  • 0

Can you do

array['Name'];

In C#

Rather than:

array[0];

I know you can do that in PHP but is there an equivelent for C#, although im thinking highley unlikely 🙁

  • 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-14T09:05:16+00:00Added an answer on May 14, 2026 at 9:05 am

    it’s called a Dictionary in C#. Using generics you can actually index by any type. Like so:

    Dictionary<Person, string> dictionary = new Dictionary<Person, string>();
    Person myPerson = new Person(); 
    dictionary[myPerson] = "Some String";
    ...
    string someString = dictionary[myPerson];
    Console.WriteLine(someString);
    

    This obviously prints, “Some String” to the console.

    This is an example of the flexibility of the dictionary. You can do it with a string as an index too, like you asked for.

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

Sidebar

Related Questions

Is there a similar function like in_array() but that can check array keys, instead
In PHP, I can specify array literals quite easily: array( array(name => John, hobby
is there a good function that can combine array by key ? ( in
Can PHP array passed POST method to catch in ASP.NET MVC? Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3
How can i array a string, in the format that $_POST does... kind of,
I'm wondering if the index of an array can be given a name in
In C# 2008, what is the Maximum Size that an Array can hold?
When key name starts with digit, in javascript we can define array-like object like
I can limit an array to values less than or greater than using individual
I can create an array of buttons in Windows Form but how can i

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.