标签:
//你感受一下 一定是类
class Program
{
static void Main(String[] args)
{
var t = typeof(A);
var pName = t.GetProperty("Name");
//4.0或以上版本
var displayName = pName.GetCustomAttribute<DisplayNameAttribute>();
Console.WriteLine(displayName.DisplayName);
Console.ReadKey();
}
}
public class A
{
[DisplayName("张三")]
public String Name { get; set; }
}标签:
原文地址:http://www.cnblogs.com/louby/p/4914619.html