PropertyInfo from Delegate

Posted by Paul Hatcherian on Stack Overflow See other posts from Stack Overflow or by Paul Hatcherian
Published on 2010-04-28T01:00:47Z Indexed on 2010/04/28 1:03 UTC
Read the original article Hit count: 322

Filed under:
|
|

Is there a simple way to get the PropertyInfo for a property in a delegate, assuming it is a simple property seletor?

Example:

var propertyInfo = Method<MyClass,int>(s => s.Property);

...

PropertyInfo Method(Func<T1,T2> selector)
{
   // What goes here?
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about delegates