1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:45:41 +00:00

Remove bool->unsigned methods

This commit is contained in:
Oliver Booth 2022-02-14 16:03:38 +00:00
parent 334e706b68
commit 0e8af01a9d

View File

@ -1,105 +0,0 @@
namespace X10D
{
public static partial class BooleanExtensions
{
/// <summary>
/// Converts the current Boolean value to the equivalent 8-bit signed integer.
/// </summary>
/// <param name="value">The Boolean value to convert.</param>
/// <returns>1 if <paramref name="value" /> is <see langword="false" />, or 0 otherwise.</returns>
/// <example>
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="sbyte" /> values.
/// <code lang="csharp">
/// bool falseFlag = false;
/// bool trueFlag = true;
///
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToSByte());
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToSByte());
/// // The example displays the following output:
/// // False converts to 0.
/// // True converts to 1.
/// </code>
/// </example>
/// <seealso cref="SByteExtensions.ToBoolean(sbyte)" />
[CLSCompliant(false)]
public static sbyte ToSByte(this bool value)
{
return (sbyte)(value ? 1 : 0);
}
/// <summary>
/// Converts the current Boolean value to the equivalent 16-bit unsigned integer.
/// </summary>
/// <param name="value">The Boolean value to convert.</param>
/// <returns>1 if <paramref name="value" /> is <see langword="false" />, or 0 otherwise.</returns>
/// <example>
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="ushort" /> values.
/// <code lang="csharp">
/// bool falseFlag = false;
/// bool trueFlag = true;
///
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToUInt16());
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToUInt16());
/// // The example displays the following output:
/// // False converts to 0.
/// // True converts to 1.
/// </code>
/// </example>
/// <seealso cref="UInt16Extensions.ToBoolean(ushort)" />
[CLSCompliant(false)]
public static ushort ToUInt16(this bool value)
{
return (ushort)(value ? 1 : 0);
}
/// <summary>
/// Converts the current Boolean value to the equivalent 32-bit unsigned integer.
/// </summary>
/// <param name="value">The Boolean value to convert.</param>
/// <returns>1 if <paramref name="value" /> is <see langword="false" />, or 0 otherwise.</returns>
/// <example>
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="uint" /> values.
/// <code lang="csharp">
/// bool falseFlag = false;
/// bool trueFlag = true;
///
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToUInt32());
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToUInt32());
/// // The example displays the following output:
/// // False converts to 0.
/// // True converts to 1.
/// </code>
/// </example>
/// <seealso cref="UInt32Extensions.ToBoolean(uint)" />
[CLSCompliant(false)]
public static uint ToUInt32(this bool value)
{
return value ? 1U : 0U;
}
/// <summary>
/// Converts the current Boolean value to the equivalent 64-bit unsigned integer.
/// </summary>
/// <param name="value">The Boolean value to convert.</param>
/// <returns>1 if <paramref name="value" /> is <see langword="false" />, or 0 otherwise.</returns>
/// <example>
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="ulong" /> values.
/// <code lang="csharp">
/// bool falseFlag = false;
/// bool trueFlag = true;
///
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToUInt64());
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToUInt64());
/// // The example displays the following output:
/// // False converts to 0.
/// // True converts to 1.
/// </code>
/// </example>
/// <seealso cref="Int64Extensions.ToBoolean(long)" />
[CLSCompliant(false)]
public static ulong ToUInt64(this bool value)
{
return value ? 1UL : 0UL;
}
}
}