原帖地址:https://www.cnblogs.com/soundcode/p/6227739.html 比如我现在
原帖地点:https://www.cnblogs.com/soundcode/p/6227739.html
好比我此刻有一个Student的东西,里面有属性stuName,stuAge,stuGender,我此刻该怎么写循环才华遍历这几个属性?
Student s=new...... foreach (System.Reflection.PropertyInfo p in s.GetType().GetProperties()) { Console.WriteLine("Name:{0} Value:{1}", p.Name, p.GetValue(s)); }
,温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/35444.html