C#7 tuple & async

Step 1: add the ValueTuple nuget package to your project.

Step 2: as Lucas says in his comment, change the syntax to:

private async Task<(SomeArray[], AnotherArray[], decimal)>GetInvoiceDetailAsync(
    InvoiceHead invoiceHead) 
{ 
    ...
    return (x, y, z); 
}

Note though that you can also then add names to those tuple items, along the lines of:

private async Task<(SomeArray[] x, AnotherArray[] y, decimal z)>GetInvoiceDetailAsync(
    InvoiceHead invoiceHead) 
{ 
    ... 
    return (x, y, z); 
}

And you can then access them as those names, rather than Item1, Item2 and Item3.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)