There is a class Employee, defined below:
class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}
and I need to fill in the list of expressions, something like below:
var expressions = new List<Expression<Func<Employee, object>>>()
{
e => e.Id,
e => e.Name
}
but that should be based on another string which is
var fields = new List<string>() { "Id", "Name" };
So the idea is to fill the expressions list with those fields which are there in the fields string list. Therefore we will search those exact field names in the Employee class and based on that get the property and fill the expressions list.