I have to make multiple requests to get some data from a REST webAPI
(it’s a lot of data and the service doesn’t give it to me all in one single request).
To do that, I’m using do while
and it’s all working fine.
My question is simple: is there a way of, when I deserialize the result, add the additional data to the previous data?
I’m using:
Data = JsonConvert.DeserializeObject<MyCLASS>(Content);
and I’m looking for something like:
Data += JsonConvert.DeserializeObject<MyCLASS>(Content); //syntax error
I know a workaround to this. But it implies to declare another MyClass (to fill with all the data), create a list, add the new data, convert the list to an array and overwrite MyClass at every request. Something like the ‘+=’ operator woulb be great (or another easier method). Do you know how?