Add dynamic column Linq in where condition using refelection in c#
string filterValue = "ABC", filterColumName = "ClientName";
clients = clients.Where(x => x.GetType().GetProperty(filterColumName).GetValue(x).ToString() == filterValue).ToList();
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tapan PatelPosted Oct 11, 2017, 9:26 AM