如何以 xamarin 形式调用同步 Web 服务调用?

how to call synchronous web service call in xamarin forms?

我正在 xamarin 表单中创建一个需要同步 Web 服务调用的应用程序。但只有 GetAsync 以 xamarin 形式提供。谁能解释一下如何以 xamarin 形式调用同步 Web 服务调用?

尝试这样的事情

public Webservice() { }
public Home GetHome()
{
    string strpost = "";
    var client = new System.Net.Http.HttpClient();
    client.BaseAddress = new Uri(" xyz ");
    var response = client.PostAsync(new Uri(" xyz "), str).Result;
    var result = JsonConvert.DeserializeObject<Home>(response.Content.ReadAsStringAsync().Result);
    Home home = new Home();
    if (!Equals(result, null))
    {
        home = result;
        return home;
    }
}

参考:https://forums.xamarin.com/discussion/43397/how-to-call-synchronous-webservice