using System; using System.Reflection; using System.Web; namespace WebApplication5 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { HttpRuntime hr = new HttpRuntime(); DisplayValues(hr); } public void DisplayValues(object o) { Type type = o.GetType(); outPut("<hr>Methods<br>"); MethodInfo[] methodInfos = type.GetMethods(); foreach (MethodInfo m in methodInfos) { outPut(m.Name); } outPut("<hr>Fields<br>"); FieldInfo[] fieldInfos = type.GetFields(); foreach (FieldInfo f in fieldInfos) { outPut(f.Name + ": " + f.GetValue(null).ToString()); } outPut("<hr>Properties<br>"); PropertyInfo[] propertyInfos = type.GetProperties(); foreach (PropertyInfo p in propertyInfos) { outPut(p.Name + ": " + p.GetValue(null, null).ToString()); } } public void outPut(string s) { ltl1.Text += s + "<br>"; } } }