how to remove xmlnode within a foreach loop?

前端 未结 5 1831
北荒
北荒 2021-01-07 04:04

At the following code i use foreach loop to check each node in nodelist and remove some of them. after i remove one node the foreach loop throw the following error: \"The el

5条回答
  •  孤街浪徒
    2021-01-07 04:47

    You are not allowed to change a collection used during a foreach iteration. You can use For..loop instead

    for(int i=0; i

提交回复
热议问题