Skip to content

Async Awaitable Methods

Ali Yousefi edited this page Jan 2, 2018 · 1 revision

Just write "Async" for your interface methods you can have both of sync and async methods; Name and parameters of methods is important:

    [SignalGo.Shared.DataTypes.ServiceContract("TestServerModel")]
    public interface ITestServerModel
    {
        //your sync method of HelloWorld
        string HelloWorld(string yourName);
        //your async method of HelloWorld
        Task<string> HelloWorldAsync(string yourName);
    }

if your sync method name is "HelloWorld" you must add "Async" word after your method name and add return of method inside of Task, for example if your method return is string you must change it to Task;

Note: you can remove sync method and make HelloWorld return type to Task without renaming to "HelloWorldAsync"