Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Web Services

$
0
0

I working on creating a Xamarin.Forms Android application that calls a web service.

Example Service Interface:

[ServiceContract]
    public interface IService
    {
        [OperationContract]
    Task<Result> method();
    }

Example Service Class:

public class Service : IService
{
    public async Task<Result>method()
    {
        var result = new Result();
        result = await dataAccess();
        return result;
    }
}

The problem that I am having is that when I generate the service using SlSvcUtil.exe it creates **void **asynchronous methods with event handlers. Is there a way to create the service reference so that it returns **tasks ** instead of void?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>