I have a method in which I would like to return an instance of an object of a parameterized type T ie. Foo<T> .
Type T is created within the method using GetType() from a string element in an XML file. Since neither the class nor the method knows about it before it was created, I also cannot parameterize it.
Is there a way to return an object of type Foo<T> from a non-generic method?
EDIT: this is the signature of a method, for example:
public Foo<T> getFooFromXml(string name) {
where is the type created internally and the method and class are nonequivalent?
source share