开发者

asp.net get Strongly Typed from string

开发者 https://www.devze.com 2022-12-16 13:24 出处:网络
My error code: string model = \"Content\"; Type stype = Type.GetType(\"mvc.Models.\" + model); ViewPage<stype>开发者_JAVA技巧; vp = new ViewPage<stype>();

My error code:

string model = "Content";
Type stype = Type.GetType("mvc.Models." + model);
ViewPage<stype>开发者_JAVA技巧; vp = new ViewPage<stype>();

Of course it error when compiling, but it clearly show what i'm thinking. Can i do this?


That function GetType needs an assembly-qualified name, not just the namespace as you have provided.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号