I am writing one LINQ to select data from entity. I have list of data with different attributes. One of the attribute could be null. so when it get null it giving me an below error
Error:
Object reference not set to instance of an object
Here is LINQ code:
var maxName = NameLookup.Select(c => c.DESC.Length).Max()
If DESC has null value than it should be also acceptable. I mean to say i want to handle if it contains null value.
Try this: