Using the LINQ Keyword "First"

All day I was stumped on why there wasn’t a simple way to grab the first object in a sequence other than using:


Then I discovered the keyword First. I’m still a little puzzled as to why .Single would throw an exception if more than a single element would be returned. I can’t really see a practical use for it unless you wanted to force only 1 object being returned.

Leave a Reply

Your email address will not be published. Required fields are marked *