【发布时间】:2021-02-20 20:36:12
【问题描述】:
我有一个名为 Students 的属性,其类型为 List<Student>。
在反射中我可以得到学生属性的值。
现在的问题是如何迭代学生列表。
我需要检查 StudentID [ some value ] 是否在该集合中。
var collection = studentPro.GetValue(studentObj,null);
//I need to iterate like this,
foreach(var item in collection)
{
if(item.StudentID == 33)
//Do stuff
}
请帮帮我。
【问题讨论】:
标签: c# reflection