Blog LogoBlog Logo

Tag: FirstOrDefault

All tags

Code Review: FirstOrDefault()

I regularly review the code that I maintain. Recently, I've come across code like this fairly often: someCollection.FirstOrDefault().Id I cannot rightly...

— 09 Apr 2015

LINQ: FirstOrDefault without the null check afterwards.

So, I was considering a problem I had that called for a LINQ statement that contains a FirstOrDefault() call. If there was an object returned I wanted a string...

— 28 May 2012