How can I use reflection to create a generic List with a custom class (List<CustomClass>)? I need to be able to add values and use propertyInfo.SetValue(..., ..., ...) to store it. Would I be better off storing these List<>’s as some other data structure?
Edit:
I should have specified that the object is more like this, but Marc Gravell’s answer works still.
class Foo { public List<string> Bar { get; set; } }
1 Answer