diff --git a/X10D/Int16Extensions.cs b/X10D/Int16Extensions.cs index 5e8d0fb..f37949c 100644 --- a/X10D/Int16Extensions.cs +++ b/X10D/Int16Extensions.cs @@ -112,5 +112,23 @@ /// otherwise. public static bool IsPrime(this short number) => ((long) number).IsPrime(); + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this short value) => + value != 0; + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this ushort value) => + value != 0; } } \ No newline at end of file diff --git a/X10D/Int32Extensions.cs b/X10D/Int32Extensions.cs index 8f03a5d..055aad7 100644 --- a/X10D/Int32Extensions.cs +++ b/X10D/Int32Extensions.cs @@ -111,5 +111,23 @@ /// otherwise. public static bool IsPrime(this int number) => ((long)number).IsPrime(); + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this int value) => + value != 0; + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this uint value) => + value != 0; } } diff --git a/X10D/Int64Extensions.cs b/X10D/Int64Extensions.cs index 84d6284..ccab490 100644 --- a/X10D/Int64Extensions.cs +++ b/X10D/Int64Extensions.cs @@ -134,5 +134,23 @@ return true; } + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this long value) => + value != 0; + + /// + /// Gets an boolean value that represents this integer. + /// + /// The integer. + /// Returns if is 0, + /// otherwise. + public static bool ToBoolean(this ulong value) => + value != 0; } }