1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:25:43 +00:00

🎨 Alphabetize method definitions

This commit is contained in:
Oliver Booth 2020-04-18 23:05:57 +01:00
parent a0de8ceb11
commit 1bee1952f9
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0

View File

@ -5,35 +5,6 @@
/// </summary>
public static class BooleanExtensions
{
/// <summary>
/// Gets an integer value that represents this boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns 1 if <paramref name="value"/> is <see langword="true"/>, 0 otherwise.</returns>
public static int ToInt32(this bool value)
{
return value ? 1 : 0;
}
/// <summary>
/// Gets a byte value that represents this boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns 00000001 if <paramref name="value"/> is <see langword="true"/>, otherwise 0000000.</returns>
public static byte ToByte(this bool value)
{
return value ? (byte)1 : (byte)0;
}
/// <summary>
/// Toggles this booleans current state.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns the opposite state of this boolean.</returns>
public static bool Not(this ref bool value)
{
return value = !value;
}
/// <summary>
/// Gets the value of this boolean and another boolean.
@ -46,28 +17,6 @@
return value && comparison;
}
/// <summary>
/// Gets the value of this boolean or another boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <param name="comparison">The boolean comparator.</param>
/// <returns>Returns <see langword="true"/> if <paramref name="value"/> or <paramref name="comparison"/> is <see langword="true"/>.</returns>
public static bool Or(this bool value, bool comparison)
{
return value || comparison;
}
/// <summary>
/// Gets the value of this boolean exclusively or another boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <param name="comparison">The boolean comparator.</param>
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> and <paramref name="comparison"/> are <see langword="false"/> or if <paramref name="value"/> and <paramref name="comparison"/> are <see langword="true"/>.</returns>
public static bool XOr(this bool value, bool comparison)
{
return value ^ comparison;
}
/// <summary>
/// Gets the value of this boolean and another boolean.
/// </summary>
@ -90,6 +39,47 @@
return !(value || comparison);
}
/// <summary>
/// Toggles this booleans current state.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns the opposite state of this boolean.</returns>
public static bool Not(this ref bool value)
{
return value = !value;
}
/// <summary>
/// Gets the value of this boolean or another boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <param name="comparison">The boolean comparator.</param>
/// <returns>Returns <see langword="true"/> if <paramref name="value"/> or <paramref name="comparison"/> is <see langword="true"/>.</returns>
public static bool Or(this bool value, bool comparison)
{
return value || comparison;
}
/// <summary>
/// Gets an integer value that represents this boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns 1 if <paramref name="value"/> is <see langword="true"/>, 0 otherwise.</returns>
public static int ToInt32(this bool value)
{
return value ? 1 : 0;
}
/// <summary>
/// Gets a byte value that represents this boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <returns>Returns 00000001 if <paramref name="value"/> is <see langword="true"/>, otherwise 0000000.</returns>
public static byte ToByte(this bool value)
{
return value ? (byte)1 : (byte)0;
}
/// <summary>
/// Gets the value of this boolean and another boolean.
/// </summary>
@ -100,5 +90,16 @@
{
return !(value ^ comparison);
}
/// <summary>
/// Gets the value of this boolean exclusively or another boolean.
/// </summary>
/// <param name="value">The boolean.</param>
/// <param name="comparison">The boolean comparator.</param>
/// <returns>Returns <see langword="false"/> if <paramref name="value"/> and <paramref name="comparison"/> are <see langword="false"/> or if <paramref name="value"/> and <paramref name="comparison"/> are <see langword="true"/>.</returns>
public static bool XOr(this bool value, bool comparison)
{
return value ^ comparison;
}
}
}