HttpClient PostAsJsonAsync请求

时间:2015-09-29 12:42:42

标签: c# httpclient

我正在尝试将一个Object作为httprequest的一部分发送。这些值从Specflow表填充。

public class Request
{
    public Dictionary<string, dynamic> RequestParameters = 
                                                    new Dictionary<string, dynamic>();
    public void setRequestParameters(Table table)
    {

        foreach (var row in table.Rows)
        {
            try
            {
                RequestParameters.Add(row[0], row[1]);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}

Request request = new Request();
request.setRequestParameters(table);
var result = client.PostAsJsonAsync<Request>(_address.ToString(), request).Result;

该值已发送但我不希望memberName(RequestParameters)包含值。有没有办法忽略它?

{
   "RequestParameters":{  
      "InitialCashAmount":"10000.00",
      "TransferAmount":"5000.00",
      "PersonalRegularContribution":"100.00"
   }
}

1 个答案:

答案 0 :(得分:0)

使用 request.RequestParameters

Remaining_Amount = '".$sess_id."' - '".$Paid_Amount."'