I am trying to hit a get type API in Xamarin Forms in pcl.I used Lot of methods but in the end every method give me error of reference.is it possible to hit get type API .
following is my current code
public void GetChruch()
{
HttpClient httpClient = new HttpClient();
Task<Stream> streamAsync = httpClient.GetStreamAsync("http://192.168.0.136:555/api/User/UserData");
Stream result = streamAsync.Result;
}
private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{
}
else
{
try
{
var result = JsonConvert.DeserializeObject<List<MyModel>>(e.Result);
}
catch (Exception ex)
{ }
}
}
public Dictionary<int, string> FacilityChruch
{
var dictionary = new Dictionary<int, string>();
foreach (var item in list)
{
dictionary.Add(item.id, item.campusName);
}
return dictionary;
}
}