mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
✨ Add ToBoolean()
ToBoolean() returns false if value is 0, true otherwise
This commit is contained in:
parent
445929e1b8
commit
e537b9c727
@ -112,5 +112,23 @@
|
||||
/// otherwise.</returns>
|
||||
public static bool IsPrime(this short number) =>
|
||||
((long) number).IsPrime();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this short value) =>
|
||||
value != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this ushort value) =>
|
||||
value != 0;
|
||||
}
|
||||
}
|
@ -111,5 +111,23 @@
|
||||
/// otherwise.</returns>
|
||||
public static bool IsPrime(this int number) =>
|
||||
((long)number).IsPrime();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this int value) =>
|
||||
value != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this uint value) =>
|
||||
value != 0;
|
||||
}
|
||||
}
|
||||
|
@ -134,5 +134,23 @@
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this long value) =>
|
||||
value != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an boolean value that represents this integer.
|
||||
/// </summary>
|
||||
/// <param name="value">The integer.</param>
|
||||
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> is 0,
|
||||
/// <see langword="true"/> otherwise.</returns>
|
||||
public static bool ToBoolean(this ulong value) =>
|
||||
value != 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user