adsense

Sunday, September 9, 2012

Linq check null or empty string

You can use following ways to check if a field is null or empty in Linq

1)

var objField=
from item in tabelName
where item.field== null || item.field.Equals(string.Empty)
select item;

2)
var objField=
from item in tabelName
where string.IsNullOrEmpty(item.field)
select item;

cheers
samitha

No comments:

Post a Comment