Getting data out form a script to the C# that ran it

I'd like to use data generated by a scirpt in the C# code that compiled and ran it, like this:

   LINQPad.ObjectModel.QueryCompilation compiledScript = LINQPadUtil.Compile("SomeScript.linq");
   LINQPad.ObjectModel.QueryExecuter exec = 
   CompiledScript.Run(LINQPad.QueryResultFormat.Text);
   exec.Wait();
   // Here I want to use data generated in the script - what's the best way to do this?

Comments

  • If you want to use the script's output, i.e., what it dumped, use exec.AsString().

    If you want to use the script's return value, i.e.:
    string Main()
    {
    	return "hello, world";
    }
    then use exec.ReturnValue.
  • Fantabulous !
    tx
  • Another question,
    What about runtime info from the script, such as
    int Progress;
    ?
  • That's not possible - it doesn't provide any mechanism to communicate with the script while in progress.
  • in LINQPad6 then?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!