Collection was modified; enumeration operation may not execute

当用foreach遍历ObservableCollection,如果使用Add或Remove操作,会出现以下错误:

Collection was modified; enumeration operation may not execute

 

解决办法是改为使用for循环。

posted @ 2012-02-13 13:32  左手边的爱  阅读(287)  评论(0编辑  收藏  举报