I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType>
In an event of ControlA i need to add a new instance of unknownType to the List in IInterfaceB…
unknownType needs specific properties so i immediately thought it could be an interface, but quickly realised interfaces cannot be instantiated…
How would you design this system?
EDIT the current inheritance chain looks like this:
topLevelClass -> baseObject -> IBaseObject (which is implemented in topLevelClass)
so if i added a new class to the chain it would need to do the inheriting and implementing which would be impossible (afaik)
If I’m interpreting this correctly, you could add a constraint on unknownType to be of some interface that contains the properties you need: