G
Guest
I have a reason to resuse hashtables and I'd like to set the values to null
without having to reload the keys.- > which is what the clear method does.
If I try a foreach construct I get an error that I cannot alter the value.
The documentation for using an enumerator and moveNext also have the same
restriction.
WONT WORK:
private Hashtable hashValueNuller(Hashtable theHash)
{
foreach (DictionaryEntry dObj in theHash)
{
dObj.Value = null;
}
return theHash;
}
Is the only way out of this to use a clear and constructor takling an array
of keys ?
without having to reload the keys.- > which is what the clear method does.
If I try a foreach construct I get an error that I cannot alter the value.
The documentation for using an enumerator and moveNext also have the same
restriction.
WONT WORK:
private Hashtable hashValueNuller(Hashtable theHash)
{
foreach (DictionaryEntry dObj in theHash)
{
dObj.Value = null;
}
return theHash;
}
Is the only way out of this to use a clear and constructor takling an array
of keys ?