{"id":15696720,"url":"https://github.com/cxuesong/asyncenumerableextensions","last_synced_at":"2025-05-08T23:28:07.847Z","repository":{"id":65414075,"uuid":"106906041","full_name":"CXuesong/AsyncEnumerableExtensions","owner":"CXuesong","description":"Build compatible IAsyncEnumerable\u003cT\u003e implementation with one generator function on both .NET Standard 1.1 and 2.1!","archived":false,"fork":false,"pushed_at":"2019-07-28T16:41:48.000Z","size":22,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T20:47:12.802Z","etag":null,"topics":["async-enumerable"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CXuesong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-14T06:58:40.000Z","updated_at":"2024-06-19T22:30:21.000Z","dependencies_parsed_at":"2023-01-22T09:55:12.021Z","dependency_job_id":null,"html_url":"https://github.com/CXuesong/AsyncEnumerableExtensions","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CXuesong%2FAsyncEnumerableExtensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CXuesong%2FAsyncEnumerableExtensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CXuesong%2FAsyncEnumerableExtensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CXuesong%2FAsyncEnumerableExtensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CXuesong","download_url":"https://codeload.github.com/CXuesong/AsyncEnumerableExtensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253162504,"owners_count":21863935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-enumerable"],"created_at":"2024-10-03T19:09:45.575Z","updated_at":"2025-05-08T23:28:07.821Z","avatar_url":"https://github.com/CXuesong.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[CXuesong.AsyncEnumerableExtensions](https://www.nuget.org/packages/CXuesong.AsyncEnumerableExtensions) | ![NuGet version (CXuesong.AsyncEnumerableExtensions)](https://img.shields.io/nuget/vpre/CXuesong.AsyncEnumerableExtensions.svg?style=flat-square) ![NuGet version (CXuesong.AsyncEnumerableExtensions)](https://img.shields.io/nuget/dt/CXuesong.AsyncEnumerableExtensions.svg?style=flat-square)\n\n# AsyncEnumerableExtensions\n\n\u003e   As of May, 2019, there is `IAsyncEnumerable` on .NET Standard 2.1 / .NET Core 3.0. Thus this package uses built-in `IAsyncEnumerable` instead of the one in `Ix.Async` on these supporting platform. Note that on .NET Standard 1.1, this package will still target to `Ix.Async`.\n\nBuilding your asynchronous sequence, i.e. `IAsyncEnumerable\u003cT\u003e` implementation with asynchronous generator methods! This helper package let you write one generator function, and it's compatible with both .NET Standard 1.1 and .NET Standard 2.1.\n\n```c#\n[Fact]\npublic async void NormalGeneratorTest()\n{\n    var finished = false;\n    async Task Generator(IAsyncEnumerableSink\u003cint\u003e sink)\n    {\n        // Yield some items.\n        await sink.YieldAndWait(10);\n        await sink.YieldAndWait(20);\n        // Do some work.\n        await Task.Delay(100);\n        // Yield some more items.\n        await sink.YieldAndWait(new[] {30, 40});\n        // Ditto.\n        await Task.Delay(100);\n        await sink.YieldAndWait(50);\n        finished = true;\n    }\n\n    // Replace ToArray with ToArrayAsync on .NET Core 3.0 / .NET Standard 2.1\n    var array = await AsyncEnumerableFactory.FromAsyncGenerator\u003cint\u003e(Generator).ToArray();\n    Assert.True(finished);\n    Assert.Equal(new[] {10, 20, 30, 40, 50}, array);\n}\n```\n\nFor more usage examples, including cancellation support, see [`UnitTestProject1/UnitTest1.cs`](UnitTestProject1/UnitTest1.cs).\n\n## Use this package with .NET Core 3.0 Preview\n\nWhen consuming this package with .NET Core 3.0 Preview, be sure to install the `System.Linq.Async` NuGet package with version higher than `4.0.0-preview.6.build.801`, or you may see the following error during run time when calling certain extension methods like `ToList`.\n\n```\n  Error Message:\n   System.MissingMethodException : Method not found: 'System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1\u003cSystem.__Canon\u003e System.Threading.Tasks.TaskExtensions.WithCancellation(System.Collections.Generic.IAsyncEnumerable`1\u003cSystem.__Canon\u003e, System.Threading.CancellationToken)'.\n  Stack Trace:\n     at System.Linq.AsyncEnumerable.\u003cToListAsync\u003eg__Core|620_0[TSource](IAsyncEnumerable`1 _source, CancellationToken _cancellationToken) in d:\\a\\1\\s\\Ix.NET\\Source\\System.Linq.Async\\System\\Linq\\Operators\\ToList.cs:line 25\n     …\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxuesong%2Fasyncenumerableextensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcxuesong%2Fasyncenumerableextensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcxuesong%2Fasyncenumerableextensions/lists"}