The .FirstOrDefault(…) LINQ’s method is quite handy until you realize that “default” in fact means default(T) which then means “null” if you deal with reference types. This could cause problems if you expect anything but null.
What if you have a Null Object you’d like to provide as the “default” instead of default(T)?
The easiest workaround is to add an additional, overloaded version of FirstOrDefault which could accept a reference to an object which should be returned as the “default”:
Your goal is to achieve the same effect but with no new extension methods. In other words – you are restricted to the standard set of LINQ operators.