
怎样遍历winform中的所有对象
1个回答
展开全部
Type t = tc.GetType();//获得该类的Type //再用Type.GetProperties获得PropertyInfo[],然后就可以用foreach 遍历了 foreach (PropertyInfo pi in t.GetProperties { object value1 = pi.GetValue(tc, null));//用pi.GetValue获得值 string name..
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询