Too many arguments in BeginXXX for FromAsync?

后端 未结 3 1975
说谎
说谎 2021-02-13 05:12

I have an async method with the following signature:

IAsyncResult BeginGetMyNumber(string foo, string bar, string bat, int bam, AsyncCallback callback, object s         


        
3条回答
  •  梦毁少年i
    2021-02-13 05:50

    Actually it seems I can use the overloaded method for Factory.FromAsync( that takes an IAsyncResult object as the first argument and a callback method as the second:

    result = Task.Factory.FromAsync(
                    instance.BeginGetMyNumber("foo", "bar", "bat", 1, null, null),
                    instance.EndGetMyNumber);
    

提交回复
热议问题