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