linq to sql - LINQ2SQL A problem with return items based on a parameter -


i occured strange problem. have method

public static void processcategories(int? myid) {   var tmplist = adapter.category.where(x => x.idparentcategory == myid).tolist(); } 

when myid == null (the parameter), tmplist doesn't contain elements, if type

x.idparentcategory == null items returned. why ?

try this:

public static void processcategories(int? myid) {   var tmplist = adapter.category.where(x => x.idparentcategory == myid || (myid == null && x.idparentcategory == null)).tolist(); } 

Comments

Popular posts from this blog

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -