mer. 24 novembre 2010, 10h35
Gregory Adam
atoutfox.public.association
Re: Enrichir une collection en la parcourant
Il parait que .. ajouter et supprimer des elements d'une collection quand on utilise foreach est une mauvaise habitude
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/47f3105e-9423-4288-951d-78854ba9f45dThe harder requirement is that you are not allowed to modify the collection. Which is easy enough to see if you try to answer these questions:
- How do you get the next element after the current one when you delete the current one?
- If you insert an element, should it be included in the iteration?
Modifier des elements d'une collection lors d'un foreach est permis
Gregory
"Thierry N" wrote in message news:icild7$1u4h$1@news.niouzes.net...
Merci à Jean et Gregory pour leurs analyses
Ne pouvant être sûr de cet algorithme, j'ai choisi de traiter les fichiers
sans les ajouter au projet.
thn
"Thierry N" <none@zenbuyer.com> a écrit dans le message de
news:iceb90$2k8u$1@news.niouzes.net...
> Bonsoir,
>
> à votre avis, dans cette boucle
>
> FOR EACH loFile IN m.loProject.Files FOXOBJECT
> loProject.Files.Add(someFile)
> ENDFOR
>
> le(s) fichier(s) ajoutés seront-ils parcourus par la boucle FOR EACH ?
>
> merci,
> thn
>
>
>
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000004440