T
T
TheTalion2016-09-29 21:00:22
C++ / C#
TheTalion, 2016-09-29 21:00:22

How can I make the return type be Task?

Trying to apply the following solutions for websockets ( https://github.com/jjrdk/websocket-sharp/blob/mast... and immediately ran into a problem.
Code:

public class Echo : WebSocketBehavior
  {
    protected override void OnMessage(MessageEventArgs e)
    { Send(e.Data); }
  }

в браузере сборок метод OnMessage выглядит так:

using System;
using System.Threading.Tasks;

protected virtual Task OnMessage (MessageEventArgs e);

An error appears on the OnMessage method, the content of which is:
Error CS0508: 'Echo.OnMessage(MessageEventArgs)': return type must be 'Task' to match member overridden 'WebSocketBehavior.OnMessage(MessageEventArgs)'.

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question