在linq中查询为null的数据

var menuData = (from d in dbContext.T_Menu
                         where d.ParentID == (Guid?)null
                         orderby d.OrderNum
                         select new MenuModel {ID=d.ID,Name=d.Name,ControllerName=d.ControllerName,ActionName=d.ActionName,OrderNum=d.OrderNum}).ToList();

 

from o in Orders  
where o.ShippedDate==null  
select o  
from o in Orders  
where Nullable<DateTime>.Equals(o.ShippedDate,null)  
select o 
Orders  
   .Where (o => Object.Equals (o.ShippedDate, null))
from o in Orders  
where !o.ShippedDate.HasValue  
select o
Orders  
   .Where (o => !(o.ShippedDate.HasValue)) 

 

posted @ 2016-05-12 12:34  wjl910  阅读(276)  评论(0)    收藏  举报