How to return all values of a column as null except one column value in LINQ?
I want to return only one column value and other column values as null from database. how can i do that in LINQ? also have to make values of not nullable fields to null w开发者_如何学编程hile retrieving
C#
var results = from item in db.items
select (item.col1 == value ? item.col1 : null);
VB.NET
Dim results = From item in db.items
Select iif(item.col1 == value ? item1.col : Nothing)
精彩评论