News for hackers. Stuff that matters.
Re:Shell Scripting with Elixir by neonsunset on Tuesday February 13, 2024 @05:48AM (#39356470)
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)

There are no comments on this comment yet.