How do linq Last() work?

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-05-20T10:14:28Z Indexed on 2010/05/20 10:20 UTC
Read the original article Hit count: 201

Filed under:
|
|

I dont understand how current can be null and last can be an object while last being a LINQ function. I thought last uses GetEnumerator and keeps going until current == null and returns the object. However as you can see the first GetEnumerator().Current is null and last somehow returns an object.

How do linq Last() work?

var.GetEnumerator().Current
var.Last()

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET