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

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -