-
Aug 28th, 2012, 01:27 PM
#1
Lively Member
iterate through a hashtable with multiple values
I have a hashtable with 7 keys, and each key contains an array list.
How do I go about iterating through all the values for each key? Thanks.
-
Aug 28th, 2012, 04:40 PM
#2
Lively Member
Re: iterate through a hashtable with multiple values
I was able to figure it out by using dictionary instead of hashtable if anyone else has a similar question
Dictionary<string, ArrayList> dictionary = new Dictionary<string, ArrayList>();
for (int i = 0; i < dictionary["Test"].Count; i++)
{
foreach (KeyValuePair<string, ArrayList> item in dictionary)
{
if (item.Key == "Test")
{
MessageBox.Show(item.Value[i].ToString());
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules