If your given a Type Object like
var myType = typeof(SomeClass)
Is it possible to get the original type, being an interface or class and using it in generics.
for example
var myObject = container.Resolve<myType>()
so this would create an object of type SomeClass in this situation.
To clarify i’m trying to create a wrapper around an Ioc container so the Ioc framework can change without affecting any other code.
If
container.Resolvemeans one ofUnityContainer.Resolvefamily, than there’s overload, that acceptsTypeinstance:It’s a common feature for DI- or IoC-containers – to have coupled resolution overloads, for generic use-cases, and for non-generic ones.