如何利用反射来获取类的常量
此类相关文章
http://www.cnblogs.com/allenlooplee/archive/2004/10/22/55618.html
http://www.microsoft.com/china/msdn/library/langtool/vcsharp/miszipcompression.mspx
webMenu myMenu = new webMenu();
Type mytype = myMenu.GetType();
System.Reflection.FieldInfo[] myFieldInfo = mytype.GetFields();
//FieldInfo fieldinfo = mytype.GetField("_UserCouldExecutedt", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
if(myFieldInfo!=null)
{
for(int i=0;i<myFieldInfo.Length;i++)
{
Response.Write(myFieldInfo[i].GetValue(null).ToString());
}
}
Type mytype = myMenu.GetType();
System.Reflection.FieldInfo[] myFieldInfo = mytype.GetFields();
//FieldInfo fieldinfo = mytype.GetField("_UserCouldExecutedt", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
if(myFieldInfo!=null)
{
for(int i=0;i<myFieldInfo.Length;i++)
{
Response.Write(myFieldInfo[i].GetValue(null).ToString());
}
}