从一个字符串创建一个类的实例 [英] Create an instance of a class from a string
本文介绍了从一个字符串创建一个类的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法来创建基于我知道类在运行时的名称实际上是一个类的实例。基本上我将有类的字符串名称。
Is there a way to create an instance of a class based on the fact I know the name of the class at runtime. Basically I would have the name of the class in a string.
推荐答案
看看的<一个href="http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx">Activator.CreateInstance方法。
这篇关于从一个字符串创建一个类的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文