I want to replace the value for a particular key in a Directory(Of TKey, TValue) when I know that the key already exists.
It's in a loop of the type:
for each KVP in Directory if NeedsChanging(KVP.Value) Directory(KVP.Key)=NewValue end if next
But I get an error as this also potentially updates the key and destroys the loop. Is there any way round this, apart from batching up the replacements in a list during the loop and updating the directory entries in a separate loop?
Or is there a Replace(TKey, TValue) method for Directory which I've not managed to find?
Peter