./nugetz

#await

184 packages tagged with “await

AsyncEnumerator

Introduces IAsyncEnumerable, IAsyncEnumerator, ForEachAsync(), and ParallelForEachAsync() GitHub: https://github.com/Dasync/AsyncEnumerable PROBLEM SPACE Helps to (a) create an element provider, where producing an element can take a lot of time due to dependency on other asynchronous events (e.g. wait handles, network streams), and (b) a consumer that processes those element as soon as they are ready without blocking the thread (the processing is scheduled on a worker thread instead). EXAMPLE using Dasync.Collections; static IAsyncEnumerable<int> ProduceAsyncNumbers(int start, int end) { return new AsyncEnumerable<int>(async yield => { // Just to show that ReturnAsync can be used multiple times await yield.ReturnAsync(start); for (int number = start + 1; number <= end; number++) await yield.ReturnAsync(number); // You can break the enumeration loop with the following call: yield.Break(); // This won't be executed due to the loop break above await yield.ReturnAsync(12345); }); } // Just to compare with synchronous version of enumerator static IEnumerable<int> ProduceNumbers(int start, int end) { yield return start; for (int number = start + 1; number <= end; number++) yield return number; yield break; yield return 12345; } static async Task ConsumeNumbersAsync() { var asyncEnumerableCollection = ProduceAsyncNumbers(start: 1, end: 10); await asyncEnumerableCollection.ForEachAsync(async number => { await Console.Out.WriteLineAsync($"{number}"); }); } // Just to compare with synchronous version of enumeration static void ConsumeNumbers() { var enumerableCollection = ProduceNumbers(start: 1, end: 10); foreach (var number in enumerableCollection) { Console.Out.WriteLine($"{number}"); } }

v4.0.229.7M
IAsyncEnumerableIAsyncEnumeratorForEachAsyncParallelForEachAsyncasync

Bnaya.CSharp.AsyncExtensions

Useful extensions contribution by Bnaya Eshet Blog: http://blogs.microsoft.co.il/bnaya/ Source Code: https://github.com/bnayae/Bnaya.CSharp.AsyncExtensions # NuGet this library available on NuGet via Install-Package Bnaya.CSharp.AsyncExtensions ## This library have the following goodies: * Exception Handling * ThrowAll (produce AggregateException when waiting on Task.WhenAll) * Format (format async exception into friendlier call-stack representation) * Timeout (will apply timeout semantic for any Task) * WithTimeout (will throw on timeout) * IsTimeoutAsync (will return indication without throwing, ideal for SLA checks [practice: check and produce warning]) * Cancellation * CancelSafe (will run the CancellationTokenSource.Cancel within try catch and prevent unexpected side effect which can happen when cancellation token registration throw) * Friendly async locking facilities (which can replace the classical lock statement). * Extensions * TryAcquireAsync * AcquireAsync * Instance-able * AsyncLock * WhenN: use to complete task after n task succeed THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

v1.0.68305.6K
asyncParallelawaittasktimeout