public static T UploadJson <T>(string url, string body, WebHeaderCollection header) { var wc = new WebClientEx2(); wc.Headers = header; return(wc.UploadString(url, body).JsonDeserialize <T>()); }
public static T DownloadJson <T>(string url, WebHeaderCollection header) { var sw = Stopwatch.StartNew(); try { var wc = new WebClientEx2(); wc.Headers = header; return(wc.DownloadString(url).JsonDeserialize <T>()); } finally { Trace.WriteLine($"Download data completed: URL [{url}], Time [{sw.ElapsedMilliseconds}ms].", "Downloader"); } }