mirror of https://github.com/oliverbooth/X10D
✨ Add BooleanExtensions
ToInt32() returns 1 if value is true, 0 otherwise
This commit is contained in:
parent
cae360edc3
commit
445929e1b8
|
@ -0,0 +1,22 @@
|
|||
namespace X10D
|
||||
{
|
||||
#region Using Directives
|
||||
|
||||
using System;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="Boolean"/>.
|
||||
/// </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) =>
|
||||
value ? 1 : 0;
|
||||
}
|
||||
}
|
|
@ -44,6 +44,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BooleanExtensions.cs" />
|
||||
<Compile Include="ByteExtensions.cs" />
|
||||
<Compile Include="CharExtensions.cs" />
|
||||
<Compile Include="ConvertibleExtensions.cs" />
|
||||
|
|
Loading…
Reference in New Issue