日期:2014-05-18 浏览次数:20827 次
Type t=typeof(类名); MemberInfo[] members=t.GetMembers(); foreach(MemberInfo nextMember in members) { if(nextMember.DeclaringType==typeof(String) && nextMember.MemberType== MemberTypes.Property) //do something }
------解决方案--------------------
Type type=typeof(myclass); System.Reflection.PropertyInfo[] pis=type.GetProperties(); foreach (System.Reflection.PropertyInfo pi in pis) { if (pi.GetType().Name == "string") { ..... } }