in VBA, it support us to add/edit code programatically in a module through VBE.
Do we have any similar method in VB.NET or any other language ?
if we're able to let the program write function by itself then it'll be very interesting to see.
For example:
I have module A, it have function test() inside now I have code-string of function Hello() I want to add to module A I read some post those are on-fly complier.
I have Class School, which have method AddStudent() Now I saw a usefull method AddTeacher() somewhere in the internet. I don't wanna open class School then copy/paste or type those code of method AddTeacher().
Is there anyway I can add that method into Class School like this:
Dim Harvard as new School Harvard.addMethod "string code of method AddTeacher()" Harvard.addTeacher "Sarah", "Math"
More detail:
I have class School
Public Class School
Public Function AddMethod(strCode$)
'magic method
End Function
Public Function AddStudent(ClassName$, Number%)
End Function
End Class
after I run the 2nd example (I don't know exactly way)
class School mutate into this:
Public Class School
Public Function AddMethod(strCode$)
'magic method
End Function
Public Function AddStudent(ClassName$, Number%)
End Function
Public Function AddTeacher(Name$, subject$)
End Function
End Class