Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么我在修改集合时收到错误,在 C# 中发布应用程序时枚举操作可能无法执行?
这意味着您直接/间接尝试更改对集合中对象的引用之一。
在一次迭代中:
foreach(var item in myCollection) { item = new Item(); // Error item.Prop = "Something"; //OK }