Hello world!


Testing source code:

class ReflectionUtility

 public static string GetPropertyName<T, TReturn>(Expression<Func<T, TReturn>> expression)
 MemberExpression body = (MemberExpression)expression.Body;
 return body.Member.Name;

 public static string GetMethodName<T, TReturn>(Expression<Func<T, TReturn>> expression)
 var body = expression.Body as UnaryExpression;
 var operand = body.Operand as MethodCallExpression;
 var argument = operand.Arguments[2] as ConstantExpression;
 var methodInfo = argument.Value as System.Reflection.MethodInfo;

 return methodInfo.Name;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: