I have class Test:
class Test
{
public int Id {get;set;}
public string Name {get;set;}
}
And function Exec which accepts expression:
void Exec<T>(Expression<Func<T, object>> expression)
{
}
...
Exec<Test>(t => t.Id);
How can I get the property name used in expression? In the code above this should be Id.