3 ms·
F# and C# are very different to C++ in this regard. Parallel downloads in C# boil down to using var http = new HttpClient(); var urls = new[] {
by neonsunset 3y ago
F# and C# are very different to C++ in this regard.
Parallel downloads in C# boil down to
using var http = new HttpClient();
var urls = new[]
{
"http://example.com/file1.jpg",
"http://example.com/file2.jpg",
/* ... */
};
var files = await Task.WhenAll(
urls.Select(http.GetByteArrayAsync));
(you can replace '.GetByteArrayAsync' with .GetFromJsonAsync, .GetStreamAsync and more depending on your needs and e.g. forward the incoming data directly to files on the disk or another source)