class Person
{
public int Age { get; set; }
}
class Program
{
static void Main()
{
var person = new Person();
var age = InfoOf(() => person.Age);
Console.WriteLine(age.Name);
}
static PropertyInfo InfoOf<T>(Expression<Func<T>> ex)
{
return (PropertyInfo)((MemberExpression)ex.Body).Member;
}
}