日期:2014-05-18 浏览次数:21069 次
<%@ Page Language="C#" %>
<script runat="server">
    public void Page_Load(object sender, EventArgs e)
    {
        System.Collections.Generic.List<string> source = new System.Collections.Generic.List<string> { "A", "B", "C", "D", "E" };
        foreach (object data in source)
        {
            Type type = data.GetType();
            foreach (System.Reflection.PropertyInfo property in type.GetProperties())
            {
                object propertyValue = property.GetValue(data, null);
                string value = (propertyValue == null) ? string.Empty : propertyValue.ToString();
                Response.Write(property.Name + " = " + value + ",");
            }
            Response.Write("<br />");
        }
    }
</script>