码迷,mamicode.com
首页 > Windows程序 > 详细

c# 泛型demo

时间:2019-08-18 17:31:52      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:pos   app   head   post   private   base   async   cli   pcl   

private void Fn_Post<T>(T dto, string api)
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = new Uri("http://localhost:51529/");
            string json = DefaultJsonSerializer.Serialize(dto);
            HttpContent httpcontent = new StringContent(json);
            httpcontent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var result = client.PostAsync(api, httpcontent).Result;
            client.Dispose();
        }

 

c# 泛型demo

标签:pos   app   head   post   private   base   async   cli   pcl   

原文地址:https://www.cnblogs.com/jasonlai2016/p/11372900.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!