Return value of UploadStringAsync().?

后端 未结 3 798
臣服心动
臣服心动 2021-01-21 21:01

My question is correct or incorrect I don\'t know, but I would like to know if is it possible to return the value of UploadStringAsync() of post methods using WebClient?

<
3条回答
  •  感情败类
    2021-01-21 21:36

    There is nothing to return from that function. You've already set up an event handler for UploadStringCompleted, you can get the result of the action in the handler.

    This is the signature:

    public delegate void UploadStringCompletedEventHandler(
        Object sender,
        UploadStringCompletedEventArgs e
    )
    

    The second parameter has the information you need: UploadStringCompletedEventArgs, the Result property contains the server's response.

提交回复
热议问题