Many people are recommending (link) enumerating COM collections using a foreach
is a bad idea and always use normal for
loop to iterate. I have an Outlook Addin which uses foreach
to iterate over Items
coll开发者_如何学Goection and fails with 0x9AC70005
exception for some users. So I am wondering is foreach
causing any issues?
Can some one help to understand why foreach
is a bad idea to iterate COM collections?
精彩评论