开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜