I'm trying to get my image from my local database in wp8. Some cells in the image column contain the actual image(in a binary format) whereas others are NULL. Here is the code:
var image_professor = (from n in College.professor
where n.Surname == Getsurname(MyLongListSelector2.SelectedItem.ToString()) && n.FirstName == GetFirstname(MyLongListSelector2.SelectedItem.ToString())
select n.Pic).Single();
Everything works fine if I click on a professor which images is stored in the database,but if a professor without an image is selected then I get a NullException. Is there a way that I could use a if-else check inside my Linq query and somehow get another value if the query run's on Null or should I use another approach.