{"id":24118154,"url":"https://github.com/dotnettools/eventextensions","last_synced_at":"2025-08-27T04:03:56.400Z","repository":{"id":41361871,"uuid":"356347811","full_name":"dotnettools/EventExtensions","owner":"dotnettools","description":"An extension to .NET events to support asynchronous events and collect the returned values","archived":false,"fork":false,"pushed_at":"2024-01-07T18:07:12.000Z","size":39,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T10:19:10.897Z","etag":null,"topics":["async","csharp","dotnet","events"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotnettools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-04-09T17:18:28.000Z","updated_at":"2024-06-29T09:15:28.000Z","dependencies_parsed_at":"2024-01-07T19:23:56.231Z","dependency_job_id":null,"html_url":"https://github.com/dotnettools/EventExtensions","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"08979fa632ad798f365bf569353c681af62c3b31"},"previous_names":["javidshoaei/eventextensions"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnettools%2FEventExtensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnettools%2FEventExtensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnettools%2FEventExtensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnettools%2FEventExtensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnettools","download_url":"https://codeload.github.com/dotnettools/EventExtensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241175841,"owners_count":19922585,"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","csharp","dotnet","events"],"created_at":"2025-01-11T08:18:28.057Z","updated_at":"2025-02-28T15:34:30.498Z","avatar_url":"https://github.com/dotnettools.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EventExtensions\nThis library adds a few extension methods to events. While it's not best practice to have async events, this library attempts to provide the following features:\n\n- Collect the returned values of event handlers synchronously or asynchronously.\n- Invoke an event asynchronously.\n- Handles NULL events; since it checks for null values inside the extension methods and thus throws no null-pointer exceptions.\n\n## What is exactly added?\n- `InvokeAsync` to simply invoke async events\n- `Collect` to collect the returned values by invoking synchronous events\n- `CollectAsync` to invoke async events and collect the returned values\n- `AsyncEventHandler` and `AsyncEventHandler\u003cT\u003e` as the asynchronous versions of `EventHandler` and `EventHandler\u003cT\u003e`\n\n## Installation\nInstall via \u003ca href=\"https://www.nuget.org/packages/EventExtensions/\"\u003eNuGet\u003c/a\u003e.\n\n    Install-Package EventExtensions -Version 2.2.0\n\n## Getting Started\n\n```csharp\nusing EventExtensions;\nusing System;\n\npublic class Program\n{\n    public event Func\u003cint, Task\u003cint\u003e\u003e MyEvent;\n\n    public async Task Run() {\n        MyEvent += SimpleHandler;\n        var results = await MyEvent.CollectAsync(8); // There are other flavors to this method such as 'InvokeAsync'!\n        foreach (var result in results)\n            Console.WriteLine(result);\n    }\n\n    private async Task\u003cint\u003e SimpleHandler(int num)\n    {\n        await Task.Delay(TimeSpan.FromSeconds(1));\n        return num * 2;\n    }\n\n    public static Task Main(string[] args) {\n        return new Program().Run();\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnettools%2Feventextensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnettools%2Feventextensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnettools%2Feventextensions/lists"}