Last active
July 26, 2018 14:14
-
-
Save pczajkowski/64a7977c70b5bd6ba3c0e5d27472517f to your computer and use it in GitHub Desktop.
Async pickle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static async Task<List<string>> DownloadTMXsAsync(List<TMInfo> tms) | |
{ | |
List<Task> tasks = new List<Task>(); | |
List<string> tmxs = new List<string>(); | |
foreach (var tm in tms) | |
{ | |
tasks.Add(Task.Run(async () => | |
{ | |
var result = await _memoQTM.DownloadTMXAsync(".", tm.Guid); | |
if (result.status.Equals("ok", StringComparison.InvariantCultureIgnoreCase)) | |
tmxs.Add(result.filename); | |
})); | |
} | |
Task.WaitAll(tasks.ToArray()); | |
return tmxs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static async Task<(string, string)[]> DownloadTMXsAsync(List<TMInfo> tms) | |
{ | |
return await Task.WhenAll(tms.Select(x => _memoQTM.DownloadTMXAsync(".", x.Guid))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment