c# - Get Current Index for Removal in String Collection -


i have string collection populated id's -->

12345 23456 34567 

and on. need @ user's request, , when parameters met, go through list, starting @ top, , perform method() using id. if successful remove list , move on.

i, embarrassingly, have never worked collection before in manner. can point me in right direction. examples seem of console.writeline(""); variety.

my base, ignorant, attempt looks -->

 var driups = settings.default.driupdates.getenumerator();         while (driups.movenext())         {             var wassuccessfull = performdriupdate(driups.current);             if (wassuccessfull)             {                 driups.current.remove(driups.current.indexof(driups.current));             }         } 

the part concerned remove(); isn't there better way current index? , tips, hints, criticism, pointers, etc....welcome. thanks!

you quite right concerned 'remove' during enumeration. how somethign this:

int idx = 0; while (idx < strcol.count) {     var wassuccessful = performdriupdate(strcol[idx]);     if (wassuccessful)         strcol.removeat(idx);     else         ++idx; } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -