如何使用RestSharp过滤空值?

问题描述 投票:0回答:1

我用RestSharp做了一个请求:

var request = new RestRequest("api/timerecord", Method.GET);
var response = client.Execute<List<TimeRecordDTO>>(request);

TimeRecords包含Property SettledOn。它具有DateTime-Value或null值:

...,"SettledOn":null,...

要么

...,"SettledOn":"2018-01-02T18:26:01",...

现在我尝试过滤此属性。我只想要TimeRecords,其中SettledOn为null。

我试过这个

var request = new RestRequest("api/timerecord", Method.GET);
request.AddParameter("SettledOn", null);
var response = client.Execute<List<TimeRecordDTO>>(request);

但我仍然得到所有时间记录。

我该怎么做才能过滤实体?

c# rest restsharp
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.