When I use this code below, I get an object reference error, it may be because there is no match for the spider. My question is: how to check for a null value in these situations
int fooID = foos.FirstOrDefault(f => f.Bar == "spider").ID;
I use the same script for different conditions to extract different elements from a list, for example
int fooID = foos.FirstOrDefault(f => f.Bar == "spider").ID; String fooDescription = foos.FirstOrDefault(f => f.Sides == "Cake").Description;
Is there any other way to check for null values.
Mohan source share