Hi,
Is it possible to write a method which can take both a normal
instansiated type and reflection instansiated type?
For example, the following code doesn't work. It throws a casting
exception claiming that a type cannot be converted to another type
(they are both the same reported type - RoundedRectangle):
///code that sets classThatImplementsFactorySuppliedInterface by
enumerating types in an assembly. Works fine
///...
//problem code
ConstructorInfo cInfo =
classThatImplementsFactorySuppliedInterface.GetCon structor(argumentTypes);
object o = cInfo.Invoke(new object[] { });
Console.WriteLine(((RoundedRectangle)o).ZIndex.ToS tring()); //throws
casting exception
Perhaps this isn't possible - i'd like to write a factory method which
can select a dll dynamically and invoke its interface methods to
provide data access. The factory method can also opt to instansiate a
concrete type declared in the executing assembly (which implements the
interface).
Is this even possible?
Thanks in advance
Matt