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 🙁
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
it’s called a
Dictionaryin C#. Using generics you can actually index by any type. Like so: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.