How can I get objects and property values from expression trees?

Posted on Dot net Slackers See other posts from Dot net Slackers
Published on Thu, 11 Mar 2010 00:00:00 GMT Indexed on 2010/03/12 0:37 UTC
Read the original article Hit count: 581

Filed under:
This is a follow-up to the Getting Information About Objects, Types, and Members with Expression Trees post, so I would recommend that you read that one first. Among other code examples in that blog post, I demonstrated how you can get a property name as a string by using expression trees. Here is the method. public static string GetName<T>(Expression<Func<T>> e) { var member = (MemberExpression)e.Body; return member.Member.Name; } And here is how you can use it. string...

Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.



Email this Article

© Dot net Slackers or respective owner

How can I get objects and property values from expression trees?

Posted on Dot net Slackers See other posts from Dot net Slackers
Published on Thu, 11 Mar 2010 00:00:00 GMT Indexed on 2010/03/12 1:57 UTC
Read the original article Hit count: 581

Filed under:
This is a follow-up to the Getting Information About Objects, Types, and Members with Expression Trees post, so I would recommend that you read that one first. Among other code examples in that blog post, I demonstrated how you can get a property name as a string by using expression trees. Here is the method. public static string GetName<T>(Expression<Func<T>> e) { var member = (MemberExpression)e.Body; return member.Member.Name; } And here is how you can use it. string...

Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.



Email this Article

© Dot net Slackers or respective owner