//自定义的类
model m = new model();
 
//取得类的Type实例
//Type t = typeof(model); 
 
//取得m的Type实例
Type t = m.GetType(); 
 
string className = t.Name +"\r\n"; 
 
//获取所有方法 
System.Reflection.MethodInfo[] methods = t.GetMethods(); 
 
//获取所有成员
System.Reflection.MemberInfo[] members = t.GetMembers(); 
 
//获取所有属性 
System.Reflection.PropertyInfo[] properties = t.GetProperties(); 
 
//取得类的属性名并获取属性值
foreach (System.Reflection.PropertyInfo s in t.GetProperties())
{
    className  += s.Name + ":" + m.GetType().GetProperty(s.Name).GetValue(m, null).ToString() + "\r\n";
}