https://handcraftsman.wordpress.com/2008/11/11/how-to-get-c-property-names-without-magic-strings/
public static class ReflectionUtility
{
public static string GetPropertyName<T>(Expression<Func<T>> expression)
{
MemberExpression body = (MemberExpression) expression.Body;
return body.Member.Name;
}
}
文章標籤
全站熱搜
