Mapping with Expressions
Posted by: K. Scott Allen,
on 14 Nov 2008 |
View original | Bookmarked: 0 time(s)
Once you know about the magic of Expression<T>, its hard not to make use of it. Or perhaps, abuse it. Here is an excerpt of a class I wrote that uses Expression<T> as a reflection helper. public class PropertySpecifier<T>
{
public PropertySpecifier(
Expression<Func<T, object>> expression)
{
_expression = (expression.Body) as MemberExpression;
if (_expression == null)
{
// raise an error
...