阅读背景:

从类型名的字符串表示形式将类型转换为类型

来源:互联网 
sTypeName = ... //do some string stuff here to get the name of the type

/*
The Assembly.CreateInstance function returns a type
of System.object. I want to type cast it to 
the type whose name is sTypeName.

assembly.CreateInstance(sTypeName)

So, in effect I want to do something like:

*/

assembly.CreateInstance(sTypeName) as Type.GetType(sTypeName);
sTypeName = ... //do some string stuff here to 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: