如何将运行时参数从LINQPad脚本传递到运行它的C#类

时间:2019-03-12 12:34:08

标签: c# linqpad

在C#类中编译和运行LINQPad脚本时,我需要在运行时将脚本中的内容提取到编译并运行它的C#代码中。实现这一目标的最佳方法是什么?

具体来说,我想在GUI上显示一个进度条,该进度条将在脚本中进行更新。

public static int ScriptExecutionProgress = 0;
void SomeMethod()
{
   LINQPad.ObjectModel.QueryCompilation compiledScript = LINQPad.Util.Compile("SomeScript.linq");
   LINQPad.ObjectModel.QueryExecuter exec = 
   compiledScript.Run(LINQPad.QueryResultFormat.Text);

   // I can get a return value and read all the dumped obejcts 
   // when the "CompiledScript" concludes it's run, 
   // but I how do I display progress int (or string) that is updated in the script when it's still running??      
}

0 个答案:

没有答案