Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
/ unit-dotnet Public archive

Provides the unit type (replacement of void) for .NET

License

Notifications You must be signed in to change notification settings

vain0x/unit-dotnet

Repository files navigation

Unit

Provides Unit type (an empty struct).

What

The type which has the exactly one stateless value is called the unit type. Call the value the unit value.

While bool value represents 1 bit (yes/no), the unit value provides no information. For example, if a method gets an argument of the unit type, it has nothing to do because it knows the argument equals the unit value beforehand and it can use the unit value instead of the argument.

Why

Unit is useful as type argument where the value of the type should be ignored.

Usage

Install this package via NuGet.

using DotNetKit.Misc;

// Get the unit value.
F(default(Unit));

About

Provides the unit type (replacement of void) for .NET

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published