forked from AngryCarrot789/MultiSelectTreeView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoolBox.cs
More file actions
16 lines (13 loc) · 673 Bytes
/
Copy pathBoolBox.cs
File metadata and controls
16 lines (13 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.Runtime.CompilerServices;
namespace System.Windows {
public static class BoolBox {
public static readonly object True = true;
public static readonly object False = false;
public static readonly object NullableTrue = (bool?) true;
public static readonly object NullableFalse = (bool?) false;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static object Box(this bool value) => value ? True : False;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static object BoxNullable(this bool? value) => value.HasValue ? value.Value ? NullableTrue : NullableFalse : null;
}
}