Util.Run - return an object from sub query?

Is there any way to return an object when using Util.Run?

I keep getting an error: Object of type 'System.Object[]' cannot be converted to type 'System.String[]
I've tried returning a dynamic, an object, and a string, but all fail with the same error.
My subQuery that is being called from another query with Util.Run has signature:
string Main(string[] args)

Comments

  • edited November 2018
    I've managed to return.

    First query saved to C:\PathToSubquery\Subquery.linq:

    string Main(string input)
    {
    return input;
    }
    Second query:

    void Main()
    {
    var queryExecutor = Util.Run("C:\\PathToSubquery\\Subquery.linq",QueryResultFormat.Text, "INPUT");
    ((string)queryExecutor.ReturnValue).Dump();
    }
    Dumps INPUT.
  • Returning to this, I still can't successfully return an object. My sub-query signature looks like this:
    async Task<SomeObject> Main()
    and returns an object (class is defined in My Extensions).

    My second query calls the sub-query like this:
    var qryRunner = Util.Run("MySubQuery.linq", QueryResultFormat.Text, null);
    SomeObject result = qryRunner.ReturnValue;


    The return value is always null.
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!