728x90
        #region GetData
        /// <summary>
        /// Get 수행 결과를 반환합니다.
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static T GetData<T>(string url)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                var responseMessage = httpClient.GetAsync(url).Result;
                if (!responseMessage.IsSuccessStatusCode)
                {
                    return default(T);
                }

                string result = responseMessage.Content.ReadAsStringAsync().Result;

                return JsonConvert.DeserializeObject<T>(result);
            }
        }
        #endregion
728x90
Posted by kjun.kr
,