I asked similar questions here And here
This is a sample Type:
public class Product {
public string Name { get; set; }
public string Ti
You can use expression tree, than your code will look like this
GT.SelectedProperties.Add(p=>p.Title);
GT.SelectedProperties.Add(p=>p.IsAllowed);
You will need to create custom collection class derived from List for SelectedProperties and create add method like this
//where T is the type of your class
public string Add(Expression> expression)
{
var body = expression.Body as MemberExpression;
if (body == null)
throw new ArgumentException("'expression' should be a member expression");
//Call List Add method with property name
Add(body.Member.Name);
}
Hope this helps