Accessing a Collection Through Reflection

前端 未结 9 2149
时光说笑
时光说笑 2020-12-14 00:39

Is there a way to iterate (through foreach preferably) over a collection using reflection? I\'m iterating over the properties in an object using reflection, and when the pr

9条回答
  •  星月不相逢
    2020-12-14 01:16

    A rather straightforward approach would be to type cast the object as the collection and directly use that.

提交回复
热议问题