Hi there
I'd like to check a value in a linq query i'll pass as a parameter. It can be, that the parameter is null and so i have to check this first. Is this possible in one query?
public bool test(object MyParamObject)
{
using (DataAccessAdapter objDb = new DataAccessAdapter())
{
LinqMetaData objLinq = new LinqMetaData(objDb);
var objQuery = from a in objLinq.foo
where (MyParamObject != null && a.foo == MyParamObject.foo)
select a;
}
}
i don't like to do:
if(parameter != null)
var objQuery = from a in objLinq.foo
where a.foo == MyParamObject.foo
select a;
else
var objQuery = from a in objLinq.foo
select a;
Thanks a lot for your help!