mercredi 7 septembre 2016

using if else in Expression Queries c#

Assuming I have a linq expression query.

function a(DateTime timestamp){
from c in categories
***
if(dateTime is not null)
  //add where statement like c.UpdateDate < timestamp
***
select new Item
  {

  }
}

I would like to add the if-statement in the query when the timestamp that pass into the function is not null.

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire