I am trying to find a single statement that will work for the query below.
I can query for nulls or integer values but not both with the same code.


int? age = null;
Student student;
age = 12;
//works
student = entities.Students.Single(s => s.Age == age);
//does not work - crash
student = entities.Students.Single(s => s.Age.Equals(age));
age = null;
//works
student = entities.Students.Single(s => s.Age.Equals(age));
Note in response to the first answer:
//crashes with error - sequence contains no elements
age = null;
student = entities.Students.Single(s => s.Age == age);
Unfortunately this is well known and reported issue. The workaround is: