Given the string "string[]"
and asked to get the underlying Type for this class, one might start with:
private Type getTypeByName(string typeName)
{
if (typeName.EndsWith("[]"))
{
return something; // But what?
}
return Type.GetType(typeName);
}
What type is "string[]" and how does one reflect the type out of it?
Obviously there's a System.String
type and a System.Array
type, but I can't see how they can be reflected "together" as you would normally do for Nullable<T>
and its T with the MakeGenericType
method.
Any help to break the mind-loop I've gotten myself into will be greatly appreciated!