4
Answers

Generic parameter for Linq where clause

samba siva

samba siva

6y
196
1
I have the code like below:
 string x="Hyderabad";
var result=(from pr in db.Properties
join slp in ShortListProp on pr.PropertyId equals slp.PropertyId into gj
from dta in gj.DefaultIfEmpty()
where pr.City == x
select pr)
 
I want to pass pr.city==x dynamically.
string x="Hyderabad"; 
var query=pr.city==x;
 
var result=(from pr in db.Properties
join slp in ShortListProp on pr.PropertyId equals slp.PropertyId into gj
from dta in gj.DefaultIfEmpty()
where (query)
select pr)
Answers (4)