1
如何使用反射访问CssStyleCollection类属性(最重要的是我感兴趣的是它的键值集合)?CssStyleCollection类:通过反射访问属性
// this code runns inside class that inherited from WebControl
PropertyInfo[] properties = GetType().GetProperties();
//I'am not able to do something like this
foreach (PropertyInfo property in properties)
{
if(property.Name == "Style")
{
IEnumerable x = property.GetValue(this, null) as IEnumerable;
...
}
}
当您运行foreach循环它曾经发现“风格”,确保它不是“风格” – MethodMan