private async Task StartRequesting()
{
for (int i = 0; i < 50; i++)
{
await Task.Factory.StartNew(async () =>
{
string Result = await GetAsync("www.google.com");
Console.WriteLine(Result);
});
}
}
Console.WriteLine("Starting Request");
await StartRequesting();
Console.WriteLine("Requesting has been finished");
How can I now wait that all the Task has been finished? I tryed Task.WhenAll but the Result is then like that
Starting Request
(google result)
(google result)
(google result)
Requesting has been finished
(google result)
(google result)
Note: I dont want use it without Task.Factory.StartNew
because it takes then too long to done all the request.