我试图遍历通过响应设置的变量并对其进行过滤。我想根据联系人类型进行过滤。这可能吗?欢迎任何建议。
//Response class
public class Response<T> : Response
{
public Response();
public T Content { get; set; }
}
private async Task<string> GetKVValueAsync()
{
var KVContactInformation = await _restServiceClient.GetAsync<Response<List<KVInfoModel>>>($"{_applicationUris.GranularKVInfo}/{_KVlId}/kv");
List<KVInfoModel> TestList = new List<KVInfoModel>();
TestList = KVContactInformation.Where(Xyz => xyz.contactType == "Sample");
return TestList();
}
答案 0 :(得分:0)
您可以使用
var KVContactInformation = await _restServiceClient.GetAsync<Response<List<KVInfoModel>>>($"{_applicationUris.GranularKVInfo}/{_KVlId}/kv");
List<KVInfoModel> testList = KVContactInformation.Content.Where(Xyz => xyz.contactType == "Sample");
return testList;