It is not beautiful, in any way, but you wanted to do it as short as possible while still counting a few potential NullPointerExceptions. Please do not do this in one liner, and please do not int nullable for this. The code below is not very good and not tested, since I have no opportunity at the moment.
Please note that I would recommend doing it differently, with long if operations, for zero code repetition and readability.
Person person = ctx.Person.Where(x => x.Create > Date && x.ID.Equals("foo")).FirstOrDefault()
int age = (person != null) ? person.Age : 20;
source
share