Hi,
I have a method where I would like to return an object instance of parameterized type T ie. Foo<T>
.
The type T is instantiated within the method using GetType()
, from a string element in an XML file. Since neither the class or method knows about it before it is created, I cant parameterize either.
Is there a way I can return an object of type Foo<T>
from the non-generic method?
EDIT: That is a method signature such as:
public Foo<T> getFooFromXml(string name) {
where the type is created inside, and the method and class are both non-generic?