.ApiClient.Model.Rate cannot be serialized because

2020-05-08 08:09发布

问题:

I getting the following error, How can i solve this?

ApiClient.Model.Rate cannot be serialized because it does not have a parameterless constructor.

I think its giing while serializing but i trid issue was not resolved, please let me know how to solve this.

public List<Rate> GetRates(string FromCountry, string FromZip, string ToCountry, string ToCity, string ToState, string ToZip, int PackWeight)
        {
            List<Rate> result = null;
            try
            {
                try
                {
                    result = apiInstance.Rates(apiKey);
                }
                catch (Exception e)
                {

                    GetServiceError(e, "RatesApi.Rates");
                }
            }
            catch (Exception ex)
            {
                WebMethodResult = ex.Message;
            }
            return result;
        }