Hi all,
I used all your info to come up with the following conclusion when I needed to modify my Hashtable object.
1) Create an ArrayList from the Hashtable keys so that we have something to iterate around without involving the Hashtable.
2) Use a foreach or a for loop to iterate around each ArrayList item and change the Hashtable values as we need.
ArrayList keyList = new ArrayList(myHashTable);
for (int i=0; i < myHashTable.Count; i++)
{
string key = (string)keyList[i];
myHashTable[key] = "Change" + i;
}
This assumes that the Hashtable values are string objects but of course they can be any object!
Hope this helps.
--------------------------------
From: John Meredith
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>uWPT3M12R0KMmvk7pl5b/Q==</Id>