From 445929e1b8febc477b2cf1fc3aaa03f4457bfd8b Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 16 Nov 2019 01:51:06 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20BooleanExtensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ToInt32() returns 1 if value is true, 0 otherwise --- X10D/BooleanExtensions.cs | 22 ++++++++++++++++++++++ X10D/X10D.csproj | 1 + 2 files changed, 23 insertions(+) create mode 100644 X10D/BooleanExtensions.cs diff --git a/X10D/BooleanExtensions.cs b/X10D/BooleanExtensions.cs new file mode 100644 index 0000000..8c85799 --- /dev/null +++ b/X10D/BooleanExtensions.cs @@ -0,0 +1,22 @@ +namespace X10D +{ + #region Using Directives + + using System; + + #endregion + + /// + /// Extension methods for . + /// + public static class BooleanExtensions + { + /// + /// Gets an integer value that represents this boolean. + /// + /// The boolean. + /// Returns 1 if is , 0 otherwise. + public static int ToInt32(this bool value) => + value ? 1 : 0; + } +} diff --git a/X10D/X10D.csproj b/X10D/X10D.csproj index aaeb3bb..67c97df 100644 --- a/X10D/X10D.csproj +++ b/X10D/X10D.csproj @@ -44,6 +44,7 @@ +