Results 1 to 2 of 2

Thread: iterate through a hashtable with multiple values

Hybrid View

  1. #1
    Lively Member
    Join Date
    Nov 09
    Posts
    76

    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.

  2. #2
    Lively Member
    Join Date
    Nov 09
    Posts
    76

    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
  •