I have an IQueryable collection of Employee objects which has FirstName, LastName, Department in it. I'm passing a string of LastName separated by comma. I want to use where clause to filter data which has LastName selected as "Sharma,Gupta". Can someone help me out?
Employee class
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Department { get; set; }
public string EmpID { get; set; }
}
public IQueryable<Employee> GetEmpData(String filterExpression)
{
IQueryable<Employee> data = GetEmployeeData();
data = from da in data
where (da.LastName == "Sharma")
select da;
return data;
}
In the above method I can query a single value. filterExpression contains list of LastName separated by a comma. Can someone guide me how to use filterExpression in where clause?