Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;没有为类型';定义无参数构造函数;System.Object[]和#x27&引用;对于RestSharp_C#_Asp.net Core_Asp.net Core Webapi_Restsharp - Fatal编程技术网

C# &引用;没有为类型';定义无参数构造函数;System.Object[]和#x27&引用;对于RestSharp

C# &引用;没有为类型';定义无参数构造函数;System.Object[]和#x27&引用;对于RestSharp,c#,asp.net-core,asp.net-core-webapi,restsharp,C#,Asp.net Core,Asp.net Core Webapi,Restsharp,我试图反序列化一个响应对象,但我得到了这个错误 没有为类型“System.Object[]”定义无参数构造函数 这就是我试图将iseObject序列化到请求对象并反序列化回响应对象的地方 request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(fundTransferRequest), ParameterType.RequestBody); IRestRespon

我试图反序列化一个响应对象,但我得到了这个错误

没有为类型“System.Object[]”定义无参数构造函数

这就是我试图将iseObject序列化到请求对象并反序列化回响应对象的地方

request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(fundTransferRequest), ParameterType.RequestBody);

IRestResponse response = client.Execute(request);
IRestResponse<FundTransferResponse> res = client.Execute<FundTransferResponse>(request);

public class FundTransferResponse
{
    public string ResponseMessage { get; set; }
    public string ResponseDescription { get; set; }
    public Response Response { get; set; }
}

public class Response
{
    public string TranStatus { get; set; }
    public string TranStatusCode { get; set; }
    public string SopraReference { get; set; }
    public string ReasonCode { get; set; }
    public object[] ReasonDescription { get; set; }
}

你不能用
列表来代替吗?是的,它正在工作。谢谢,请删除这个问题,这是一个边缘案例,对其他人没有什么价值。我不认为这是一个“边缘案例”的情况。定义一个对象来容纳一组对象并不是一种边缘情况。这是一个典型的类架构,也是一个很好的问题。顺便说一句,这不是一个RestSharp问题。我们实际上不建议像这样使用RestSharp,您可以使用serialiser。您不能使用
列表
来代替吗?是的,它现在正在工作。谢谢,请删除这个问题,这是一个边缘案例,对其他人没有什么价值。我不认为这是一个“边缘案例”的情况。定义一个对象来容纳一组对象并不是一种边缘情况。这是一个典型的类架构,也是一个很好的问题。顺便说一句,这不是RestSharp的问题。我们实际上不建议像这样使用RestSharp,您可以使用serialiser。