<p>StackOverflow user jolson had a very nice piece of code that exemplifies how one can register menthods without using strings, but expression trees <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c#52998">here</a>.</p>

<p>Is it possible to have something similar for properties instead of methods? To pass a property (not the name of the property) and inside the method to obtain the property name?</p>

<p>Something like this:</p>

<pre><code>
    RegisterMethod(p => p.Name)

    void RegisterMethod(Expression??? propertyExpression) where T : Property ???
    {
        string propName = propertyExpression.Name;
    }
</code></pre>

<p>Thanks.</p>

You can write something along this:
```
```
static void RegisterMethod<TSelf, TProp> (Expression<Func<TSelf, TProp>> expression)
{
    var member_expression = expression.Body as MemberExpression;
    if (member_expression == null)
        return;

    var member = member_expression.Member;
    if (member.MemberType != MemberTypes.Property)
        return;

    var property = member as PropertyInfo;
    var name = property.Name;

    // ...
}
```
```