mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 23:45:42 +00:00
✨ Add BooleanExtensions
ToInt32() returns 1 if value is true, 0 otherwise
This commit is contained in:
parent
cae360edc3
commit
445929e1b8
22
X10D/BooleanExtensions.cs
Normal file
22
X10D/BooleanExtensions.cs
Normal file
@ -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" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="BooleanExtensions.cs" />
|
||||||
<Compile Include="ByteExtensions.cs" />
|
<Compile Include="ByteExtensions.cs" />
|
||||||
<Compile Include="CharExtensions.cs" />
|
<Compile Include="CharExtensions.cs" />
|
||||||
<Compile Include="ConvertibleExtensions.cs" />
|
<Compile Include="ConvertibleExtensions.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user