I know there has to be a better way to do this... maybe with LINQ? If I remove a value, it invalidates the iterator which is why I have this inside of an infinite loop which starts the process all over again. I'm looking for a way to do this that is easier to read, maintain and ultimately much faster. Here's what I got:
Dictionary<string, string> Channels = //...;
while (true)
{
var bFound = false;
foreach(var c in Channels)
{
if(c.Value == version)
{
Channels.Remove(c.Key);
bFound = true;
break;
}
}
if (!bFound) { break; }
}
Thanks for any help in optimizing this routine.
forloop :)