1. 程式人生 > >C# 對Foreach 的保護,因此在迭代的時候沒辦法remove add 等修改操作

C# 對Foreach 的保護,因此在迭代的時候沒辦法remove add 等修改操作

InvalidOperationException: out of sync
System.Collections.Generic.Dictionary`2+Enumerator[System.Int32,UnityEngine.GameObject].VerifyState () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:912)
System.Collections.Generic.Dictionary`2+Enumerator[System.Int32,UnityEngine.GameObject].MoveNext () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:835)