O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unwinding a Property Lambda Expression

Resolving a property’s name and creating delegates for its get and set property accessors involves unwinding of the Lambda expression and retrieving the PropertyInfo instance. In the sample code, this is done using the custom PropertyUtility.GetPropertyInfo method, which retrieves the PropertyInfo instance from the expression’s Member property, as shown:

public static PropertyInfo GetPropertyInfo<T>(Expression<Func<T>> expression){    var memberExpression = expression.Body as MemberExpression;    if (memberExpression == null)    {        throw new ArgumentException(            "MemberExpression expected.", "expression");    }    if (memberExpression.Member == null)    {         ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required