{"id":27058698,"url":"https://github.com/bomret/unit","last_synced_at":"2025-06-15T15:10:54.546Z","repository":{"id":28333683,"uuid":"31846847","full_name":"Bomret/Unit","owner":"Bomret","description":"A type that allows only one value, also known as void.","archived":false,"fork":false,"pushed_at":"2018-02-28T13:13:29.000Z","size":459,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-05T22:34:26.597Z","etag":null,"topics":["csharp","dotnet","nothing","unit","void"],"latest_commit_sha":null,"homepage":"http://bomret.github.io/Unit/index.html","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bomret.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-08T11:05:42.000Z","updated_at":"2017-02-01T23:31:12.000Z","dependencies_parsed_at":"2022-08-22T21:12:05.688Z","dependency_job_id":null,"html_url":"https://github.com/Bomret/Unit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bomret%2FUnit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bomret%2FUnit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bomret%2FUnit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bomret%2FUnit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bomret","download_url":"https://codeload.github.com/Bomret/Unit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332588,"owners_count":20921854,"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":["csharp","dotnet","nothing","unit","void"],"created_at":"2025-04-05T12:16:24.990Z","updated_at":"2025-04-05T12:16:25.601Z","avatar_url":"https://github.com/Bomret.png","language":"F#","readme":"[![Nuget](https://img.shields.io/nuget/v/TheVoid.svg)](https://www.nuget.org/packages/TheVoid/)\n\n|CI Provider|Status|\n|----------|------------|\n|Travis CI|[![Travis CI](https://img.shields.io/travis/Bomret/Unit/master.svg)](https://travis-ci.org/Bomret/Unit)|\n|AppVeyor|[![AppVeyor](https://img.shields.io/appveyor/ci/stefanreichel/unit/master.svg)](https://ci.appveyor.com/project/StefanReichel/unit)|\n\n# Unit\n\nThe Unit type allows only one value which is empty. This is similar to the `System.Void` type (`void` keyword) which can sadly not be used by user code. Using the Unit type as return value instead of `void` offers some benefits, such as the deprecation of non-generic or special classes for the purpose of communicating the absence of a return value (`Task\u003cUnit\u003e` would replace `Task`, `Func\u003cUnit\u003e` et al. would make `Action` et al. obsolete).\n\nOther languages, such as F#, Haskell or Scala already provide a Unit type, but Microsoft chose to prevent using the existing `System.Void` type in C# user code in favor of the `void` keyword.\n\n## Usage\nUse `Unit` as return value instead of the `void` keyword.\n\n```csharp\n// use\nusing TheVoid;\n\npublic Unit DoSomething() {\n  //...\n}\n\n// instead of\npublic void DoSomething() {\n  //...\n}\n```\n\nTo \"return\" Unit simply use one of the following\n  * `Unit.Default` *(recommended)*\n  * `default(Unit)`\n  * `new Unit()`\n\n## Similar projects\n* [@gregoryyoung](https://github.com/gregoryyoung) created a similar type which he called `Nothing` but it missed some things.\n* [@Reactive-Extensions](https://github.com/Reactive-Extensions/Rx.NET) the .net project contains a `System.Unit` type which is not available as a standalone package.\n\n## Planned deprecation\nThis project is deprecated as soon as any Unit type is included in C#.\n\n## Maintainer(s)\n* [@bomret](https://github.com/bomret)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbomret%2Funit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbomret%2Funit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbomret%2Funit/lists"}