Archived

This forum has been archived. Please start a new discussion on GitHub.

C# 4.5 async await

C# 4.5 feature,
Is there any plan to support?

test.ice



interface server
{
["cs:async"] int callback();
};





test.cs




class serverPrx
{
public async Task<int> callbackAsync();
public int callback();
}




using test.cs




private async Task<int> client()
{
int rtn = await serverPrx.callbackAsync();
return rtn;
}


Comments

  • instead of

    public static Task<Ice.AsyncResult> AsyncProcess(System.Action<Ice.AsyncCallback> send_proc)
    {
    TaskCompletionSource<Ice.AsyncResult> resultCompletionSource = new TaskCompletionSource<Ice.AsyncResult>();
    send_proc((recv_ir) => resultCompletionSource.SetResult(recv_ir));
    return resultCompletionSource.Task;
    }


    System.Action<Ice.AsyncCallback> send_process = (recv_proc) =>
    {
    prx.begin_callback(recv_proc, null);
    };
    int rtn = prx.end_callback(await AsyncProcess(send_process));