How can I get generic Type from a string representation?
Type.GetType("System.Collections.Generic.List.String"); // Or [String]
You can't get it from
"List<String>", but you can get it from
Type type = Type.GetType("System.Collections.Generic.List`1[System.String]");
You're lucky in this case - both
string are in mscorlib, so we didn't have to specify the assemblies.
The `1 part specifies the arity of the type: that it has one type parameter. The bit in square brackets specifies the type arguments.
Where are you getting just
List<String> from? Can you change your requirements? It's going to be easier than parsing the string, working out where the type parameters are, finding types in different namespaces and assemblies, etc. If you're working in a limited context (e.g. you only need to support a known set of types) it may be easiest to hard-code some of the details.