Type.GetType (string) using the syntax "Generic <T>"?
I am creating a common ASP.NET server control that has an attribute used to specify a type name. I use the control constructor to generate a generic version of my control by passing in the attribute value Type.GetType(string). This works great. However, if the type I want to specify is generic, I should use the syntax as follows:
<gwb:GenericControl runat="server"
TypeName="System.Collections.Generic.List`1[System.String]" />
I would like to be able to enter it like this:
<gwb:GenericControl runat="server"
TypeName="System.Collections.Generic.List<System.String>" />
I know that I could manually parse the value for angle brackets and convert them to square brackets and add the corresponding inverse pattern-numeric prefix, but I was wondering if there was a built-in way to do this conversion? I assume the syntax is Generic<T>specific to C # (or at least different in VB.NET), so I assume that I also have to parse any other language-specific syntax.
I noticed that ASP.NET MVC does this in a Inheritsdirective attribute Page, but I'm not sure how to do it.
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MyModel>" %>