mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 23:58:48 +00:00
parent
8059b067c9
commit
0197d89e48
@ -5,17 +5,16 @@ namespace X10D
|
||||
public static partial class BooleanExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 8-bit signed integer.
|
||||
/// 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">
|
||||
/// 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:
|
||||
@ -23,7 +22,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="ByteExtensions.SByteExtensions.ToBoolean(sbyte)" />
|
||||
/// <seealso cref="SByteExtensions.ToBoolean(sbyte)" />
|
||||
[CLSCompliant(false)]
|
||||
public static sbyte ToSByte(this bool value)
|
||||
{
|
||||
@ -31,17 +30,16 @@ namespace X10D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 16-bit unsigned integer.
|
||||
/// 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">
|
||||
/// 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:
|
||||
@ -49,7 +47,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int16Extensions.UInt16Extensions.ToBoolean(ushort)" />
|
||||
/// <seealso cref="UInt16Extensions.ToBoolean(ushort)" />
|
||||
[CLSCompliant(false)]
|
||||
public static ushort ToUInt16(this bool value)
|
||||
{
|
||||
@ -57,17 +55,16 @@ namespace X10D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 32-bit unsigned integer.
|
||||
/// 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">
|
||||
/// 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:
|
||||
@ -75,7 +72,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int32Extensions.UInt32Extensions.ToBoolean(uint)" />
|
||||
/// <seealso cref="UInt32Extensions.ToBoolean(uint)" />
|
||||
[CLSCompliant(false)]
|
||||
public static uint ToUInt32(this bool value)
|
||||
{
|
||||
@ -83,17 +80,16 @@ namespace X10D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 64-bit unsigned integer.
|
||||
/// 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">
|
||||
/// 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:
|
||||
@ -101,7 +97,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int64Extensions.Int64Extensions.ToBoolean(long)" />
|
||||
/// <seealso cref="Int64Extensions.ToBoolean(long)" />
|
||||
[CLSCompliant(false)]
|
||||
public static ulong ToUInt64(this bool value)
|
||||
{
|
||||
|
@ -13,18 +13,17 @@ namespace X10D
|
||||
/// <param name="value">The Boolean value.</param>
|
||||
/// <returns>A byte array with length 1.</returns>
|
||||
/// <example>
|
||||
/// The following example converts the bit patterns of <see cref="bool" /> values to <see cref="byte" /> arrays.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example converts the bit patterns of <see cref="bool" /> values to <see cref="byte" /> arrays.
|
||||
/// <code lang="csharp">
|
||||
/// bool[] values = { true, false };
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0,10}{1,16}\n", "Boolean", "Bytes");
|
||||
/// foreach (var value in values)
|
||||
/// {
|
||||
/// byte[] bytes = value.GetBytes();
|
||||
/// Console.WriteLine("{0,10}{1,16}", value, bytes.AsString());
|
||||
/// }
|
||||
///
|
||||
///
|
||||
/// // The example displays the following output:
|
||||
/// // Boolean Bytes
|
||||
/// //
|
||||
@ -38,17 +37,16 @@ namespace X10D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 8-bit unsigned integer.
|
||||
/// Converts the current Boolean value to the equivalent 8-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="byte" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="byte" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToByte());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToByte());
|
||||
/// // The example displays the following output:
|
||||
@ -56,7 +54,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="ByteExtensions.ByteExtensions.ToBoolean(byte)" />
|
||||
/// <seealso cref="ByteExtensions.ToBoolean(byte)" />
|
||||
public static byte ToByte(this bool value)
|
||||
{
|
||||
return (byte)(value ? 1 : 0);
|
||||
@ -68,12 +66,11 @@ namespace X10D
|
||||
/// <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="decimal" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="decimal" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToDecimal());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToDecimal());
|
||||
/// // The example displays the following output:
|
||||
@ -81,7 +78,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="DecimalExtensions.DecimalExtensions.ToBoolean(decimal)" />
|
||||
/// <seealso cref="DecimalExtensions.ToBoolean(decimal)" />
|
||||
public static decimal ToDecimal(this bool value)
|
||||
{
|
||||
return value ? 1.0m : 0.0m;
|
||||
@ -94,12 +91,11 @@ namespace X10D
|
||||
/// <returns>1 if <paramref name="value" /> is <see langword="false" />, or 0 otherwise.</returns>
|
||||
/// <seealso cref="DoubleExtensions.ToBoolean(double)" />
|
||||
/// <example>
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="double" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="double" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToDouble());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToDouble());
|
||||
/// // The example displays the following output:
|
||||
@ -114,17 +110,16 @@ namespace X10D
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 16-bit signed integer.
|
||||
/// Converts the current Boolean value to the equivalent 16-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="short" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="short" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToInt16());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToInt16());
|
||||
/// // The example displays the following output:
|
||||
@ -132,24 +127,23 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int16Extensions.Int16Extensions.ToBoolean(short)" />
|
||||
/// <seealso cref="Int16Extensions.ToBoolean(short)" />
|
||||
public static short ToInt16(this bool value)
|
||||
{
|
||||
return (short)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 32-bit signed integer.
|
||||
/// Converts the current Boolean value to the equivalent 32-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="int" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="int" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToInt32());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToInt32());
|
||||
/// // The example displays the following output:
|
||||
@ -157,24 +151,23 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int32Extensions.Int32Extensions.ToBoolean(int)" />
|
||||
/// <seealso cref="Int32Extensions.ToBoolean(int)" />
|
||||
public static int ToInt32(this bool value)
|
||||
{
|
||||
return value ? 1 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the current Boolean value to the equivalent 64-bit signed integer.
|
||||
/// Converts the current Boolean value to the equivalent 64-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="long" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="long" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToInt64());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToInt64());
|
||||
/// // The example displays the following output:
|
||||
@ -182,7 +175,7 @@ namespace X10D
|
||||
/// // True converts to 1.
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <seealso cref="Int64Extensions.Int64Extensions.ToBoolean(long)" />
|
||||
/// <seealso cref="Int64Extensions.ToBoolean(long)" />
|
||||
public static long ToInt64(this bool value)
|
||||
{
|
||||
return value ? 1L : 0L;
|
||||
@ -194,12 +187,11 @@ namespace X10D
|
||||
/// <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="float" /> values.
|
||||
///
|
||||
/// <code lang="csharp">
|
||||
/// The following example illustrates the conversion of <see cref="bool" /> to <see cref="float" /> values.
|
||||
/// <code lang="csharp">
|
||||
/// bool falseFlag = false;
|
||||
/// bool trueFlag = true;
|
||||
///
|
||||
///
|
||||
/// Console.WriteLine("{0} converts to {1}.", falseFlag, falseFlag.ToSingle());
|
||||
/// Console.WriteLine("{0} converts to {1}.", trueFlag, trueFlag.ToSingle());
|
||||
/// // The example displays the following output:
|
||||
|
Loading…
Reference in New Issue
Block a user