无法将类型 'string' 隐式转换为“System.Collections.Generic.List<stings>”协调器函数

Cannot implicitly convert type 'string' to 'System.Collections.Generic.List<stings>'orchestrator function

我在 this post 上看到过这个问题,但我的情况不同:

这是我尝试 return 列表值时的错误消息:

但我认为这需要更多解释函数的声明方式和需要的内容 returned:

    [FunctionName("Function1")]//function1 or F1
    public static async Task<List<string>> RunOrchestrator(
        [OrchestrationTrigger] IDurableOrchestrationContext context)
    {
        //extract the key from the context param
        var key = context.GetInput<input_key>()?.Key;

        //This list include the I value i need to send to the api
        var incrementing_values_list = new List<String>();
        for (int i = 0; i < 0x10000; i += 0x100)
        {
            string incrementing_value = "0x" + i.ToString("x16");
            incrementing_values_list.Add(incrementing_value);
        }

        var parallelTasks = new List<Task<string>>();
        for (int i = 0; i < incrementing_values_list.Count; i++) //for each value in the list called incrementing_values_list. i'll send an api request
        {
            
            ("Function1_HelloTest", incrementing_values_list[i]);
            Task<string> task = context.CallActivityAsync<string>("Function1_Hello", incrementing_values_list[i]);

            parallelTasks.Add(task);
        }
        Console.WriteLine($"************** 'Waiting' for parallel results ********************");
        await Task.WhenAll(parallelTasks);
        Console.WriteLine($"************** All activity functions complete ********************");

        parallelTasks.ForEach(i => Console.Write("{0}\t", i.Result));            


        var sb = new StringBuilder();
        foreach (var completedParallelActivity in parallelTasks)
        {
            sb.AppendLine(completedParallelActivity.Result);
        }
        
        
        return sb.ToString(); //Here is where i get the error message

}

*更新:尝试 returning 以下内容,但也出现错误

string combindedString = string.Join(",", parallelTasks);
return combindedString;

return 列表的正确方法是什么?

您必须更改函数的 return 类型。 sb.ToString()string.Join(",", parallelTasks); return 都是一个字符串。但是,您函数的 return 类型是 Task<List<string>>

能否将函数的 return 类型更改为 Task<string>public static async Task<string> RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context)