开发者

linq strange error with null

开发者 https://www.devze.com 2022-12-21 05:13 出处:网络
i have function public List<Menu> List(int? parentId) { return (from i in _dataContext.Menu where i.Menu2.Id == parentId select i).ToList();

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

精彩评论

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