下面是获取类所有信息的例子====================================================================System.Text.StringBuilder s = new StringBuilder();Type t = s.GetType();///属性Console.WriteLine( "Property ");PropertyInfo[] propertys = t.GetProperties();foreach (PropertyInfo pi in propertys)Console.WriteLine(pi.Name);Console.WriteLine( "------------- ");Console.WriteLine( "field ");///字段FieldInfo[] fields = t.GetFields();foreach(FieldInfo fi in fields)Console.WriteLine(fi.Name);Console.WriteLine( "------------- ");Console.WriteLine( "Method ");//方法MethodInfo[] methods = t.GetMethods();foreach (MethodInfo mi in methods)Console.WriteLine(mi.ReturnParameter.Member);Console.WriteLine( "------------- ");Console.WriteLine( "Event ");//事件EventInfo[] events = t.GetEvents();foreach (EventInfo ei in events)Console.WriteLine(ei.Name);判断表的字段====================================================tableName.Columns.Contains