Get all the data through C# Library in recursive function

Hi, I would like to get all the data of the schema and I know that there is a limit in each call.
Therefore, I wanna use recursive function to call it with using T type in C#.
However, I don’t know how to pass the type to the client.

public async Task<Object> test<TE, TD>(IContentsClient<TE, TD> Client, string filter, int skipCount)
        {
            var Result = await Client.GetAsync(new ContentQuery { Filter = filter, Skip = skipCount });
            if (Result.Items.Count() + skipCount < Result.Total) 
                Result.Items.AddRange(test<TE, TD>(Client, filter, skipCount + Result.Items.Count()));
            return Result;
        }

I am using the C# Squidex.ClientLibrary Ver 5.6.0

Have you seen this method: https://github.com/Squidex/squidex-samples/blob/master/csharp/Squidex.ClientLibrary/Squidex.ClientLibrary/IContentsClient.cs#L286?

I just tried it.
If I have the filter, it means I should handle it after getting all result?
My program:

await client.GetAllAsync(500, async content =>
                        {
                            await Tasktest();
                            if ({filter})
                            {
                                MyList.Add(content);
                            }
                        });

Btw, can I know why there is using Task function in the call back?

Also, is that better to do filter in Squidex or program?
I am afraid of traffic issue.

Very often this method is used for backups or export functionality. For example when you want to write 1.000.000 million records from Squidex to your database, it is a bad idea to add all records to a list first because this needs too much memory. And writing to a file or database is usually an async operation.

Depends how much you filter out. If you are only interested in 10% of the total records, it is faster to make a query, if you are interested in 90% of the total records I would do it in your program.

If I need 10% only, how can I do well with getAllAsync? Coz there are more than 1000 records.
Thanks

Oh I just changed my program and it works with recursive now. Thanks!