linq strange error with null
i have function
public List<Menu> List(int? parentId)
{
return (from i in _dataContext.Menu where i.Menu2.Id == parentId select i).ToList();
}
if i pass in function parameter null (like List(null)) it search nothing, but if i put null in query like this开发者_如何学JAVA
return (from i in _dataContext.Menu where i.Menu2.Id == null select i).ToList();
it finds records
what the problem?
Confirm in the debugger that you are actually passing in null and not 0.
精彩评论