加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Sub用于创建VB.NET中调用者传递的类型对象

发布时间:2020-12-17 00:17:10 所属栏目:大数据 来源:网络整理
导读:我在创建一个可以动态创建变量类型对象的子项时遇到了麻烦.这是我正在努力实现的一个例子: class systemSettings 'some propertiesend classClass fireSystemSettings inherits systemSettings 'some additional propertiesend classClass windSystemSettin
我在创建一个可以动态创建变量类型对象的子项时遇到了麻烦.这是我正在努力实现的一个例子:
class systemSettings
    'some properties
end class

Class fireSystemSettings
    inherits systemSettings
    'some additional properties
end class

Class windSystemSettings
    inherits systemSettings
    'some additional properties
end class

sub createSystem(systemType as Type,arg1 as object,arg2 as object)
    Dim newSystem as New systemType(arg1,arg2)
    systemCollection.add(newSystem)
end sub

我无法让它发挥作用.我已经做了很多研究,并研究了泛型类型,反射和其他工具,但我无法确定如何最好地解决这个问题.

您正在寻找Activator.CreateInstance(systemType)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读