Given this property:
Public Overridable Property Collecions As ICollection(Of String)
Which we could instantiate like this:
variable.Collecions = New List(Of String)
Or this way:
variable.Collecions = New LinkedList(Of String)
I have the following question: Isn't there an easy way to find all the types that implement ICollection
, and therefore can be instantiated? I was hoping to find them via the object browser, but haven't seen how. My google searches haven't turned up too much light either. Thanks in advance.
You have to look for all the types that implement the interface with the method
IsAssignableFrom
that checks if the instance can be assigned to theSystem.Type
passed parameter:The method
Activator.CreateInstance<ICollection<T>>
creates a new instance of the found type.Use: