vendredi 9 février 2018

C# reflection : How to set nested Property of nested Lists

Imagine following "path" :

MyObject.MyFirstList[0].MySecondList[0].MyProperty = "Hello"

MyProperty is of type String. None of the types is known at compiletime, only runtime via reflection of assembly.

I have everything, but i can not set the second list on the first with SetValue. I always get either null-ref exceptions or "target type does not match".





Aucun commentaire:

Enregistrer un commentaire