How can I access the next value in a collection inside a foreach loop in c#.

Posted by Addie on Stack Overflow See other posts from Stack Overflow or by Addie
Published on 2010-03-08T19:44:54Z Indexed on 2010/03/08 19:51 UTC
Read the original article Hit count: 236

Filed under:
|
|

I'm working c# and with a sorted List of structs. I'm trying to iterate through the List and for each iteration I'd like to access the next member of the list. Is there a way to do this?

Pseudocode example:

foreach (Member member in List)
{
    Compare(member, member.next);
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET