1. 程式人生 > >c# 技巧

c# 技巧

spa converter class eof typeof blog cnblogs mstr 遍歷屬性

1 遍歷屬性

Type t = typeof(Colors);
PropertyInfo[] pInfo = t.GetProperties();
foreach (PropertyInfo pi in pInfo)
{
    Color c = (Color)ColorConverter.ConvertFromString(pi.Name);
    ……
}

c# 技巧