I am coding a module in which I would like to create a string array that can be indexed by a string value rather than an integer. For instance, I would like to be able to code:
MyArray("054CAN")="Something"
and then later be able to reference the array values using:
MyString=MyArray("054CAN")
How can I accomplish this? Thanks for the help!
Dr. Douglas Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org
Chaplain Dou...
Member
305 Points
937 Posts
Creating and Using a "Keyed" Array
Nov 16, 2012 05:33 PM|LINK
I am coding a module in which I would like to create a string array that can be indexed by a string value rather than an integer. For instance, I would like to be able to code:
MyArray("054CAN")="Something"
and then later be able to reference the array values using:
MyString=MyArray("054CAN")
How can I accomplish this? Thanks for the help!
Good News Jail & Prison Ministry
www.goodnewsjail.org
kedarrkulkar...
All-Star
34515 Points
5554 Posts
Re: Creating and Using a "Keyed" Array
Nov 16, 2012 05:41 PM|LINK
you are actually looking for dictionary object...
check this
http://www.dotnetperls.com/dictionary
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
Vipindas
Contributor
5514 Points
810 Posts
Re: Creating and Using a "Keyed" Array
Nov 16, 2012 05:43 PM|LINK
Use Dictionary<TKey, TValue>
var dict = new Dictionary<string, string>();
dict["key_name"] = "value1";
Refer this
http://www.dotnetperls.com/dictionary