C#C
C#4y ago
memw

❔ Reflections and generics

So i have a type instance list and i'm iterating trough all the fields that the propertyType.Name.Contains("ExtensionConfig"), that type has a method which i need to invoke foreach field and i'm iterating trough the fields

So basically the problem comes when i do (field as PropertyInfo).GetValue(type) shows invalid cast exception, and i can't cast because the target type has a generic type which in every field is different
Was this page helpful?