调试执行的CodeDom?
我正在使用 codedom 来执行一些代码。是否有可能以某种方式停止执行?这是我运行代码的方式:
Dim SourceCode as String="... some VB code"
Dim MyProvider As New VBCodeProvider
Dim cp As New CompilerParameters
Dim cr As CompilerResults = MyProvider.CompileAssemblyFromSource(cp, SourceCode)
Dim methInfo As MethodInfo = cr.CompiledAssembly.GetType("Class1").GetMethod("Main")
methInfo.Invoke(Nothing, Nothing)
我的想法是将其放入线程工作程序中,如果我需要停止它,我会停止线程......但也许有更好的解决方案吗?谢谢 :)
I am using codedom to execute some code. Is it possible to stop somehow the execution? here is how i run the code:
Dim SourceCode as String="... some VB code"
Dim MyProvider As New VBCodeProvider
Dim cp As New CompilerParameters
Dim cr As CompilerResults = MyProvider.CompileAssemblyFromSource(cp, SourceCode)
Dim methInfo As MethodInfo = cr.CompiledAssembly.GetType("Class1").GetMethod("Main")
methInfo.Invoke(Nothing, Nothing)
my idea is to put this in a threadworker and if I need to stop it, i stop the thread... but is there a better solution maybe? Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论