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;
    }
}
文章標籤
全站熱搜
創作者介紹
創作者 wings890109 的頭像
wings890109

幽嵐飋翼

wings890109 發表在 痞客邦 留言(0) 人氣(120)