andrew4582

GetPropertyName

Aug 10th, 2011
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private static string GetPropertyName(LambdaExpression expression)
  2. {
  3. if (null == expression) return null;
  4.  
  5. //if (expression.Body
  6. string rhs = expression.Body.ToString();
  7. int dot = rhs.IndexOf('.');
  8. var result = (dot != -1) ? rhs.Substring(dot + 1) : null;
  9. return result;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment