I would do a intermediate step:
var resultTmp = client.Execute<ResultHeader<Dictionary<string,string>>>(request);
var finalResult = AdaptResult(resultTmp);
Where AdaptResult
can be implemented as follows:
static ResultHeader<Customer> AdaptResult(
ResultHeader<Dictionary<string, string>> tmp)
{
var res = new ResultHeader<Customer>();
res.Success = tmp.Success;
res.Total = tmp.Total;
res.List = new List<Customer>();
foreach (var el in tmp.List)
{
var cust = new Customer();
cust.Firstname = el["Firstname"];
cust.RemainingItems =
el.Where(x => x.Key != "Firstname")
.ToDictionary(x => x.Key, x => x.Value);
res.List.Add(cust);
}
return res;
}
Of course the adapting method will contain your check logic (e.g. fail if all questions are in the dictionary etc.)