-1

I've class like this (it's just example)

class child
   inherits parent1
end class

and then at runtime i want change become like this

class child
   inherits grandfatherclass
end class

I've been trying with code like this, sadly it's still inherits from 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)

Is it possible to replace existing class with CodeDom generated class...?

1 Answers1

0

You cannot replace existing class with CodeDom. Instead you can create a new derived class and if you want. You can further inherit it again to suit your need.

Mukul Varshney
  • 3,131
  • 1
  • 12
  • 19