Reputation: 3307
Hi I have following linq query
var query=DbContext.Set<tasksList>()
Select(u=> new { tasks= u.description});
What I want to do is as it iterates through if description is null to return some other value for example return just 1 or anything. Please let me know how to achieve this Thanks
Upvotes: 1
Views: 109
Reputation: 1807
You could use the null coalescing operator.
var query = DbContext.Set<tasksList>()
.Select(u=> new { tasks= u.description ?? "just 1 or anything"});
Example: Code Project - How to Use Null-Coalescing Operator (??)
Reference: Reference MSDN
Upvotes: 5