J
jcomber
Hi,
I'd be grateful for some help...
I'm trying to create a late bound object using:
Activator.CreateInstance(Type, ConstructorParameters())
The constructor of the object takes a delegate as the only parameter.
However, ConstructorParameters() is an object array and because a
Delegate is not derived from System.Object, it won't compile.
Here's an example of what I'm trying to achieve:
Dim t As Type = Type.GetType("Namespace.ClassName,AssemblyName")
Dim p() as Object = {AddressOf DelegatedMethod}
Dim o As IObject = DirectCast(Activator.CreateInstance(t, p), IObject)
Is there a work around to this?
TIA for any help.
Regards
John.
I'd be grateful for some help...
I'm trying to create a late bound object using:
Activator.CreateInstance(Type, ConstructorParameters())
The constructor of the object takes a delegate as the only parameter.
However, ConstructorParameters() is an object array and because a
Delegate is not derived from System.Object, it won't compile.
Here's an example of what I'm trying to achieve:
Dim t As Type = Type.GetType("Namespace.ClassName,AssemblyName")
Dim p() as Object = {AddressOf DelegatedMethod}
Dim o As IObject = DirectCast(Activator.CreateInstance(t, p), IObject)
Is there a work around to this?
TIA for any help.
Regards
John.