{"id":13629314,"url":"https://github.com/HakamFostok/Disposer","last_synced_at":"2025-04-17T08:34:38.560Z","repository":{"id":144388559,"uuid":"493176881","full_name":"HakamFostok/Disposer","owner":"HakamFostok","description":"Source Generator to generate best-practice IDisposable Implementation","archived":false,"fork":false,"pushed_at":"2023-02-11T16:31:14.000Z","size":136,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T04:19:03.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/HakamFostok.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-05-17T09:11:42.000Z","updated_at":"2023-12-14T11:02:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4f56932-d18e-4f1f-9385-0882424c6924","html_url":"https://github.com/HakamFostok/Disposer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakamFostok%2FDisposer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakamFostok%2FDisposer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakamFostok%2FDisposer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakamFostok%2FDisposer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HakamFostok","download_url":"https://codeload.github.com/HakamFostok/Disposer/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:07.224Z","updated_at":"2025-04-17T08:34:38.554Z","avatar_url":"https://github.com/HakamFostok.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["65. [Disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Disposer) , in the [Disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) category"],"readme":"# Disposer\n\nA Source Generator package that generates extension methods for enums, to allow fast \"reflection\".\n\n\u003e This source generator requires the .NET 6 SDK. You can target earlier frameworks like .NET Core 3.1 etc, but the _SDK_ must be at least 6.0.100\n\nAdd the package to your application using\n\n```bash\ndotnet add package Disposer\n```\n\n\nThis adds a `\u003cPackageReference\u003e` to your project. You can additionally mark the package as `PrivateAsets=\"all\"`.\n\n\u003e Setting `PrivateAssets=\"all\"` means any projects referencing this one won't get a reference to the _Disposer_ package. \u003cbr/\u003e\n\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n\n  \u003cPropertyGroup\u003e\n    \u003cOutputType\u003eExe\u003c/OutputType\u003e\n    \u003cTargetFramework\u003enet6.0\u003c/TargetFramework\u003e\n  \u003c/PropertyGroup\u003e\n\n  \u003cPackageReference Include=\"Disposer\" Version=\"1.0.0\" \n    PrivateAssets=\"all\" /\u003e\n\n\u003c/Project\u003e\n```\n\nAdding the package will automatically add a marker attribute, `[Disposable]`, to your project.\n\nTo use the generator, add the `[EnumExtensions]` attribute to an enum. For example:\n\n```csharp\n[Disposer.Disposable]\npublic class MyClass\n{\n    partial void DisposeManaged()\n    {\n        // free managed resources here\n    }\n\n    partial void DisposeUnmanaged()\n    {\n        // free Unmanaged resources here\n    }\n}\n```\n\nThis will generate a class another partial class which implement `IDisposable` interface:\n\n```csharp\npartial class MyClass : global::System.IDisposable\n{\n    partial void DisposeManaged();\n    partial void DisposeUnmanaged();\n\n    private bool disposed = false;\n\n    ~MyClass()\n    {\n        Dispose(false);\n    }\n\n    private void Dispose(bool disposing)\n    {\n        if (disposed)\n            return;\n\n        if (disposing)\n        {\n            DisposeManaged();\n        }\n\n        DisposeUnmanaged();\n\n        disposed = true;\n    }\n\n    public void Dispose()\n    {\n        Dispose(true);\n        global::System.GC.SuppressFinalize(this);\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHakamFostok%2FDisposer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHakamFostok%2FDisposer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHakamFostok%2FDisposer/lists"}