Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use async with await common for windows and Android ?

$
0
0

Hello,

The following is my async with await function.

public async static Task GetHeader(string inputParameters, string output1) {

     var res = Task.Factory.FromAsync<string>(_client.BeginGetHeader(inputParameters, output1, DeviceTokenEntry, null, null), ar    =>                     _client.EndGetHeader(ar));

    //For Android
            res.Wait();
    //For Windows
             await res;

  return res.Result;

}

In the above function we can find //For Android res.Wait(); //For Windows await res;

But i want a common await line for Windows and Android.

Thanks, Naresh K


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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