Execute code in assembly and access its objects
i have a difficult question:
I want to write some code into a textbox and compile it at runtime, like "Application.GetSystem().ObjectList.Count" so that i can get the result and display it in another textbox.
Would this be possible? It should be flexible, but you must access the same assembly-instance. I know, CodeDOM gives you the possibility to compile assemblys at runtime, but if i used that one, it wouldn´t be the same instance and i don´t get the right result.
So, what would be a way to do this? CodeDOM looks like the right way. Reflection enables the access, but only if i use the same assembly开发者_JAVA百科... Or may i invoke the method of the generated assembly but in my programs assembly?
It´s more a theoretical question. I don´t know if i try it out, but would be nice to know :)
Yes, this is possible using reflection.
精彩评论