Link to home
Start Free TrialLog in
Avatar of Erwin Pombett
Erwin PombettFlag for Switzerland

asked on

in a foreach, how can i view the current and the next element in the bloc?

hello,
i have a foreach loop on an ArrayList,
foreach(MyObj anObj in ArrayList){
    anObj.method();
                                            <- how can i catch the following objt in the same bloc?
}

thank you in advance.
Avatar of p_davis
p_davis

add an int32 or something outside of the foreach instantiated and set = to 1. then just increment each time in the foreach you can use this to index the next value.
ASKER CERTIFIED SOLUTION
Avatar of p_davis
p_davis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial