mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 23:25:43 +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>
|
/// otherwise.</returns>
|
||||||
public static bool IsPrime(this short number) =>
|
public static bool IsPrime(this short number) =>
|
||||||
((long) number).IsPrime();
|
((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>
|
/// otherwise.</returns>
|
||||||
public static bool IsPrime(this int number) =>
|
public static bool IsPrime(this int number) =>
|
||||||
((long)number).IsPrime();
|
((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;
|
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