{"id":13629294,"url":"https://github.com/Kiryuumaru/DisposableHelpers","last_synced_at":"2025-04-17T08:34:37.084Z","repository":{"id":58842670,"uuid":"460579137","full_name":"Kiryuumaru/DisposableHelpers","owner":"Kiryuumaru","description":"Disposable helpers for IDisposable and IAsyncDisposable","archived":false,"fork":false,"pushed_at":"2025-04-09T19:59:44.000Z","size":264,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:43:17.171Z","etag":null,"topics":[],"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/Kiryuumaru.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-17T19:31:22.000Z","updated_at":"2025-04-09T19:56:14.000Z","dependencies_parsed_at":"2023-10-14T19:45:45.233Z","dependency_job_id":"57f6851d-e443-48bd-bb30-eb1fff1ad318","html_url":"https://github.com/Kiryuumaru/DisposableHelpers","commit_stats":null,"previous_names":[],"tags_count":478,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kiryuumaru%2FDisposableHelpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kiryuumaru%2FDisposableHelpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kiryuumaru%2FDisposableHelpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kiryuumaru%2FDisposableHelpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kiryuumaru","download_url":"https://codeload.github.com/Kiryuumaru/DisposableHelpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249326186,"owners_count":21251735,"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":[],"created_at":"2024-08-01T22:01:06.707Z","updated_at":"2025-04-17T08:34:36.838Z","avatar_url":"https://github.com/Kiryuumaru.png","language":"C#","funding_links":["https://ko-fi.com/kiryuumaru"],"categories":["Content"],"sub_categories":["71. [DisposableHelpers](https://ignatandrei.github.io/RSCG_Examples/v2/docs/DisposableHelpers) , in the [Disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) category"],"readme":"# DisposableHelpers\n\nDisposable helpers for IDisposable and IAsyncDisposable with source generators. Also capable of both anonymous disposable and anonymous async disposable.\n\n**NuGets**\n\n|Name|Info|\n| ------------------- | :------------------: |\n|DisposableHelpers|[![NuGet](https://buildstats.info/nuget/DisposableHelpers?includePreReleases=true)](https://www.nuget.org/packages/DisposableHelpers/)|\n\n## Installation\n```csharp\n// Install release version\nInstall-Package DisposableHelpers\n\n// Install pre-release version\nInstall-Package DisposableHelpers -pre\n```\n\n## Supported frameworks\n.NET Standard 2.0 and above - see https://github.com/dotnet/standard/blob/master/docs/versions.md for compatibility matrix\n\n## Usage\n\n### Disposable\n```csharp\nusing DisposableHelpers;\n\nnamespace YourNamespace\n{\n    public class SampleDisposable : Disposable\n    {\n        private SampleUnmanagedResource resources;\n        \n        protected override void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                resources.Release();\n            }\n            base.Dispose(disposing);\n        }\n    }\n}\n```\n### Disposable Source Generator\n```csharp\nusing DisposableHelpers.Attributes;\n\nnamespace YourNamespace\n{\n    [Disposable]\n    public partial class SampleDisposable\n    {\n        private SampleUnmanagedResource resources;\n        \n        protected void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                resources.Release();\n            }\n            base.Dispose(disposing);\n        }\n    }\n}\n```\n### Anonymous Disposable\n```csharp\nusing DisposableHelpers;\n\nnamespace YourNamespace\n{\n    public static class Program\n    {\n        private static SampleUnmanagedResource resources;\n        \n        public static void Main(string[] args)\n        {\n            Disposable disposable = new Disposable(disposing =\u003e\n            {\n                if (disposing)\n                {\n                    resources.Release();\n                }\n            });\n\n            disposable.Dispose();\n        }\n    }\n}\n```\n### AsyncDisposable\n```csharp\nusing DisposableHelpers;\n\nnamespace YourNamespace\n{\n    public class SampleAsyncDisposable : AsyncDisposable\n    {\n        private SampleAsyncUnmanagedResource resources;\n        \n        protected override async ValueTask Dispose(bool isDisposing)\n        {\n            if (isDisposing)\n            {\n                await resources.Release();\n            }\n            return base.Dispose(isDisposing);\n        }\n    }\n}\n```\n### AsyncDisposable Source Generator\n```csharp\nusing DisposableHelpers.Attributes;\n\nnamespace YourNamespace\n{\n    [AsyncDisposable]\n    public partial class SampleAsyncDisposable\n    {\n        private SampleAsyncUnmanagedResource resources;\n        \n        protected async ValueTask Dispose(bool isDisposing)\n        {\n            if (isDisposing)\n            {\n                await resources.Release();\n            }\n            return base.Dispose(isDisposing);\n        }\n    }\n}\n```\n### Anonymous AsyncDisposable\n```csharp\nusing DisposableHelpers;\n\nnamespace YourNamespace\n{\n    public static class Program\n    {\n        private static SampleAsyncUnmanagedResource resources;\n        \n        public static async void Main(string[] args)\n        {\n            AsyncDisposable disposable = new AsyncDisposable(async disposing =\u003e\n            {\n                if (disposing)\n                {\n                    await resources.Release();\n                }\n            });\n\n            await disposable.DisposeAsync();\n        }\n    }\n}\n```\n### Want To Support This Project?\nAll I have ever asked is to be active by submitting bugs, features, and sending those pull requests down!.\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://ko-fi.com/kiryuumaru)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKiryuumaru%2FDisposableHelpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKiryuumaru%2FDisposableHelpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKiryuumaru%2FDisposableHelpers/lists"}