asp还有人用吗_javascript和jsp区别

asp还有人用吗_javascript和jsp区别英文原文There’sanexistingStackOverflowquestionandexamplethatcallsExecuteAsynconRestSharp.NetCore.IsuccessfullyusedthatexamplewhenreferencingRestSharp.NetCore105.2.3withNewtonsoft.Json…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

英文原文

There’s an existing StackOverflow question and example that calls ExecuteAsync on RestSharp.NetCore.

I successfully used that example when referencing RestSharp.NetCore 105.2.3 with Newtonsoft.Json 9.0.2-beta2.

using System.Threading.Tasks;

using Newtonsoft.Json;

using Newtonsoft.Json.Serialization;

using RestSharp;

public async Task TestPost(ObjectFoo foo)

{

JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings {

ContractResolver = new CamelCasePropertyNamesContractResolver()

};

RestClient restClient = new RestClient(API_URL);

RestRequest request = new RestRequest(“SOME_METHOD”, Method.POST);

request.AddHeader(“Accept”, “application/json”);

string jsonObject = JsonConvert.SerializeObject(foo, Formatting.Indented, jsonSerializerSettings);

request.AddParameter(“application/json”, jsonObject, ParameterType.RequestBody);

TaskCompletionSource taskCompletion = new TaskCompletionSource();

RestRequestAsyncHandle handle = restClient.ExecuteAsync(

request, r => taskCompletion.SetResult(r));

RestResponse response = (RestResponse)(await taskCompletion.Task);

return JsonConvert.DeserializeObject(response.Content);

}

中文翻译

现有的StackOverflow问题和示例在RestSharp.NetCore上调用ExecuteAsync。

在使用Newtonsoft.Json 9.0.2-beta2引用RestSharp.NetCore 105.2.3时,我成功使用了该示例。

使用System.Threading.Tasks;

使用Newtonsoft.Json;

使用Newtonsoft.Json.Serialization;

使用RestSharp;

public async Task< SomeObject> TestPost(ObjectFoo foo)

{

JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings {

ContractResolver = new CamelCasePropertyNamesContractResolver()

};

RestClient restClient = new RestClient(API_URL);

RestRequest request = new RestRequest(” SOME_METHOD” ,Method.POST);

request.AddHeader(” Accept” ,” application / json” );

string jsonObject = JsonConvert.SerializeObject(foo,Formatting.Indented,jsonSerializerSettings);

request.AddParameter(” application / json” ,jsonObject,ParameterType.RequestBody);

TaskCompletionSource< IRestResponse> taskCompletion = new TaskCompletionSource< IRestResponse>();

RestRequestAsyncHandle handle = restClient.ExecuteAsync(

请求,r => taskCompletion.SetResult(R));

RestResponse response =(RestResponse)(等待taskCompletion.Task);

返回JsonConvert.DeserializeObject< SomeObject>(response.Content);

}

There’s an existing StackOverflow question and example that calls ExecuteAsync on RestSharp.NetCore.

I successfully used that example when referencing RestSharp.NetCore 105.2.3 with Newtonsoft.Json 9.0.2-beta2.

using System.Threading.Tasks;

using Newtonsoft.Json;

using Newtonsoft.Json.Serialization;

using RestSharp;

public async Task TestPost(ObjectFoo foo)

{

JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings {

ContractResolver = new CamelCasePropertyNamesContractResolver()

};

RestClient restClient = new RestClient(API_URL);

RestRequest request = new RestRequest(“SOME_METHOD”, Method.POST);

request.AddHeader(“Accept”, “application/json”);

string jsonObject = JsonConvert.SerializeObject(foo, Formatting.Indented, jsonSerializerSettings);

request.AddParameter(“application/json”, jsonObject, ParameterType.RequestBody);

TaskCompletionSource taskCompletion = new TaskCompletionSource();

RestRequestAsyncHandle handle = restClient.ExecuteAsync(

request, r => taskCompletion.SetResult(r));

RestResponse response = (RestResponse)(await taskCompletion.Task);

return JsonConvert.DeserializeObject(response.Content);

}

现有的StackOverflow问题和示例在RestSharp.NetCore上调用ExecuteAsync。

在使用Newtonsoft.Json 9.0.2-beta2引用RestSharp.NetCore 105.2.3时,我成功使用了该示例。

使用System.Threading.Tasks;

使用Newtonsoft.Json;

使用Newtonsoft.Json.Serialization;

使用RestSharp;

public async Task< SomeObject> TestPost(ObjectFoo foo)

{

JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings {

ContractResolver = new CamelCasePropertyNamesContractResolver()

};

RestClient restClient = new RestClient(API_URL);

RestRequest request = new RestRequest(” SOME_METHOD” ,Method.POST);

request.AddHeader(” Accept” ,” application / json” );

string jsonObject = JsonConvert.SerializeObject(foo,Formatting.Indented,jsonSerializerSettings);

request.AddParameter(” application / json” ,jsonObject,ParameterType.RequestBody);

TaskCompletionSource< IRestResponse> taskCompletion = new TaskCompletionSource< IRestResponse>();

RestRequestAsyncHandle handle = restClient.ExecuteAsync(

请求,r => taskCompletion.SetResult(R));

RestResponse response =(RestResponse)(等待taskCompletion.Task);

返回JsonConvert.DeserializeObject< SomeObject>(response.Content);

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/196022.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • SpringCloud(十)—–Gateway

    SpringCloud(十)—–Gateway

    2020年11月12日
    199
  • matlab保存所有图,Matlab中图片保存的5种方法

    matlab保存所有图,Matlab中图片保存的5种方法matlab的绘图和可视化能力是不用多说的,可以说在业内是家喻户晓的。Matlab提供了丰富的绘图函数,比如ez**系类的简易绘图函数,surf、mesh系类的数值绘图函数等几十个。另外其他专业工具箱也提供了专业绘图函数,这些值得大家深入学习好久。今天我只是讨论下如何保存这些由Matlab绘制出来的图像呢?当然借助第三方截图软件,就算了!1、使用imwrite函数如图像是img,则可以使用im…

    2025年9月7日
    4
  • 数据库锁表如何解决_mysql数据库怎么解锁

    数据库锁表如何解决_mysql数据库怎么解锁这个问题之前遇到过一次,但是由于不知道导致锁表的原因,也没细想,就知道表被锁了,然后让别人把表给解锁了。但是前天的一次操作,让我亲眼见证了导致锁表的过程,以及如何给lock的表解锁。1.导致锁表的原因(同志们也可以参考是不是也是同样的操作啊。。。):1.1首先是大前提我们正常的框架在service层都会有事物控制,比如我一个service层的方法要执行更新两张表,这两个表只有同…

    2022年8月23日
    6
  • 队列的基本操作(顺序队列、循环队列、链式队列)

    队列的基本操作(顺序队列、循环队列、链式队列)    队列也是一种线性表,是一种先进先出的线性结构。队列只允许在表的一端进行插入(入队)、删除(出队)操作。允许插入的一端称为队尾,允许删除的一端称为队头。    队列的基本操作包括:初始化队列:InitQueue(Q) &

    2022年5月9日
    43
  • 安装centos6.5 i686,安装vnc,配置中文界面

    安装centos6.5 i686,安装vnc,配置中文界面1.1、安装vmwaretools可以调节屏幕分辨率,同时把时间自动同步到宿主机的时间1.2、重启后修改分辨率,修改运行级别为3,然后重启开机启动图形模式(5)、文本模式(3),文本模式没有xwindow运行,图形模式即使切换到文本模式控制台,xwindow仍然运行1.3、修改网络配置cateth0的配置文件时,dhcp的,但是ifconfigeth0没有ip

    2022年5月24日
    33
  • 微信提现 ava实现微信企业付款到个人账户 转载「建议收藏」

    微信提现 ava实现微信企业付款到个人账户 转载「建议收藏」https://blog.csdn.net/baidu_37366055/article/details/81215962?utm_source=blogxgwz7后续需要使用,所以暂时转载记录一下

    2022年8月19日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号