https://github.com/comradevanti/csharpnothing
A unit/nothing type for C#
https://github.com/comradevanti/csharpnothing
csharp functional nothing unit utility
Last synced: 3 months ago
JSON representation
A unit/nothing type for C#
- Host: GitHub
- URL: https://github.com/comradevanti/csharpnothing
- Owner: ComradeVanti
- License: unlicense
- Created: 2022-09-03T13:31:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-19T10:25:17.000Z (over 1 year ago)
- Last Synced: 2025-07-02T15:11:29.724Z (3 months ago)
- Topics: csharp, functional, nothing, unit, utility
- Language: C#
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Nothing
[](https://www.nuget.org/packages/Dev.ComradeVanti.Nothing)
Nothing is a type representing the absence of data, similarly to `Unit` in
[F#](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/unit-type).
Use it as a return value from methods where you would traditionally return `void`.**⚠️ Development is paused ⚠️**
No new features will be added or bugs fixed unless requested through an issue.
If you wish to fork this repository and continue the work, you are very welcome
to do so.## Usage
`Nothing` exposes a single static readonly instance called `Nothing.atAll`. This
instance is equal to itself using both `==` and `Equals`.The package also includes a few useful extension methods which are listed below.
- Convert a `Task` to a `Task` using the `ToNothingTask` method
- Convert a `Action` to a `Func` using the `ToNothingFunc` method.
Works with up to 3 parameters
- Convert anything to `Nothing` with the `Discard` method