blowin.Tribools
1.0.0
dotnet add package blowin.Tribools --version 1.0.0
NuGet\Install-Package blowin.Tribools -Version 1.0.0
<PackageReference Include="blowin.Tribools" Version="1.0.0" />
paket add blowin.Tribools --version 1.0.0
#r "nuget: blowin.Tribools, 1.0.0"
// Install blowin.Tribools as a Cake Addin #addin nuget:?package=blowin.Tribools&version=1.0.0 // Install blowin.Tribools as a Cake Tool #tool nuget:?package=blowin.Tribools&version=1.0.0
Tribools
Examples
The tribool class supports conversion from bool values and contain Indefinitely:
var tribool = Tribool.True;
Tribool indefinitelyTribool = Tribool.Indefinitely;
Tribool trueTribool = true;
Tribool falseTribool = false;
Tribool supports conversions to bool for use in conditional statements:
var tribool = Tribool.True;
if (tribool)
Console.WriteLine("Is true\n");
else if (!tribool)
Console.WriteLine("Is false\n");
else
Console.WriteLine("Is indefinitely\n");
Tribool supports the 4-state logic operators ! (negation), && (AND), and || (OR), ^ (XOR) with bool and tribool values. For instance:
var x = Tribool.True;
var y = Tribool.False;
if(x && y) // false
{
Console.WriteLine("X and Y is true");
}
if(!(x && y)) // true
{
Console.WriteLine("X or Y is false");
}
if(x || y) // true
{
Console.WriteLine("X or Y is true");
}
if(x ^ y) // true
{
Console.WriteLine("X or Y is true");
}
Ttribool supports 3-state equality comparisons via the operators == and !=. These return a tribool:
var x = Tribool.True;
var y = Tribool.False;
Console.WriteLine("X == true: {0}", x == true); // true
Console.WriteLine("Y == false: {0}", y == false); // true
Console.WriteLine("Y == true: {0}", y == true); // false
It can be checked whether the value is undefined:
var x = Tribool.True;
var y = Tribool.Indefinitely;
Console.WriteLine("X == Indefinitely: {0}", Tribool.Maybe(x)); // false
Console.WriteLine("Y == Indefinitely: {0}", Tribool.Maybe(y)); // true
Increase and decrease in degree ++(Up), --(Down):
var x = Tribool.True;
var y = Tribool.False;
Console.WriteLine("X++: {0}", --x); // Indefinitely
Console.WriteLine("X++: {0}", --x); // False
Console.WriteLine("Y--: {0}", ++y); // Indefinitely
Console.WriteLine("Y--: {0}", ++y); // True
Tables ternary logic
A | A↗ | ↘A |
---|---|---|
F | U | F |
U | T | F |
T | T | U |
A⋀ B | F | U | T |
---|---|---|---|
F | F | F | F |
U | F | U | U |
T | F | U | T |
A | ¬ A |
---|---|
F | T |
U | U |
T | F |
A ∨ B | F | U | T |
---|---|---|---|
F | F | U | T |
U | U | U | T |
T | T | T | T |
A xor B | F | U | T |
---|---|---|---|
F | F | U | T |
U | U | U | U |
T | T | U | T |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 596 | 6/15/2019 |