【发布时间】:2016-11-21 05:12:30
【问题描述】:
我有这样的课(这只是例子)
class child
inherits parent1
end class
然后在运行时我希望改变变成这样
class child
inherits grandfatherclass
end class
我一直在尝试使用这样的代码,遗憾的是它仍然继承自 parent1
Dim onewclass As CodeDomProvider = CodeDomProvider.CreateProvider("VB")
Dim objCompilerParameters As New CodeDom.Compiler.CompilerParameters
Dim classString as string = "class child" & vbnewline & _
" inherits grandfatherclass" & vbnewline & _
"end class"
onewclass.CompileAssemblyFromSource(objCompilerParameters, classString)
是否可以用 CodeDom 生成的类替换现有的类...?
【问题讨论】: