如何从 PropertyInfo 集合中, 得到集合属性的值...
btbtd 2007-05-06 07:39:51 比如我想遍历 Request 的属性,,,
下面代码是做到了...
---/-------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ import namespace="System.Reflection" %>
<script runat="server">
void Page_Load(Object s, EventArgs e)
{
EnumProperties(Request);
} // end Page_Load
void EnumProperties(Object Obj)
{
PropertyInfo[] Props = Obj.GetType().GetProperties();
for(int i=0, j=Props.Length; i<j; i++)
{
Response.Write("<li/>Props["+i+"].Name: "+Props[i].Name);
}
}
</script>
但是我想得到每个属性的对应值, 我发傻了...该怎么弄...
比如我想得到 Request.Url 的值...
是从PropertyInfo 集合中去获取, 如果是单一遍历, 这地球人都会...