I have MyClass<T>
.
And then I have this string s = "MyClass<AnotherClass>";
. How can I get Type from the string s
?
One way (ugly) is to parse out the "<" and ">" and do:
Type acType = Type.GetType("AnotherClass");
Type whatIwant = typeof (MyClass<>).MakeGenericType(acType);
But is there a cleaner way to get the final type without any parsing, etc.?