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

Hit A Api(Get type) in Xamarin Forms pcl.

$
0
0

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;
         }
     }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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