Add ToArray to prevent 'Collection has been modified' Exception in older runtimes (#1976)

This commit is contained in:
Thomas Nind
2022-09-05 15:18:10 +01:00
committed by GitHub
parent 13948501d5
commit bfe9878554

View File

@@ -1820,7 +1820,7 @@ namespace Terminal.Gui {
/// <param name="command"></param>
public void ClearKeybinding (params Command [] command)
{
foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command))) {
foreach (var kvp in KeyBindings.Where (kvp => kvp.Value.SequenceEqual (command)).ToArray()) {
KeyBindings.Remove (kvp.Key);
}
}