LINQ on a LinkedList - iterate over LinkedListNode, not T

I'm having a problem understanding how to do something in LINQ.

I have a linkedlist, the type of the object doesn't matter. What does matter is that I want to do something in a Where() based on the relationship between the current object and the next one in the list.

Why can't I do something like:

linkedlist.Where(n=>a_function(n.Value, n.Next.Value))?

What is the syntax to do this, if it's even possible? The type inference system seems to insist that I want the lambda argument to be T, not LinkedListNode.

6
задан Tom W 23 October 2010 в 12:12
поделиться