Catcher.AndroidDemo.Common.EasyWebRequest.SendGetRequestBasedOnHttpClient C# (CSharp) Метод

SendGetRequestBasedOnHttpClient() публичный статический Метод

send the get request based on HttpClient
public static SendGetRequestBasedOnHttpClient ( string requestUrl, string>.IDictionary routeParameters ) : Task
requestUrl string the url you post
routeParameters string>.IDictionary the parameters you post
Результат Task
        public static async Task<object> SendGetRequestBasedOnHttpClient(string requestUrl, IDictionary<string, string> routeParameters)
        {
            object returnValue = new object();
            HttpClient client = new HttpClient();
            client.MaxResponseContentBufferSize = 256000;
            //format the url paramters
            string paramters = string.Join("&", routeParameters.Select(p => p.Key + "=" + p.Value));
            Uri uri = new Uri(string.Format("{0}?{1}", requestUrl, paramters));
            try
            {
                var response = await client.GetAsync(uri);
                if (response.IsSuccessStatusCode)
                {
                    var stringValue = await response.Content.ReadAsStringAsync();
                    returnValue = JsonObject.Parse(stringValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return returnValue;
        }