From 568f272c34c19a866ca5c3277a629f00e863f717 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 16 Jan 2021 13:14:27 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Implement=20To(Numeric)=20conver?= =?UTF-8?q?sion=20for=20byte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of for int - other overloads now call ToByte and implicitly cast --- X10D/src/BooleanExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/X10D/src/BooleanExtensions.cs b/X10D/src/BooleanExtensions.cs index d4d3d82..1d81fda 100644 --- a/X10D/src/BooleanExtensions.cs +++ b/X10D/src/BooleanExtensions.cs @@ -12,7 +12,7 @@ /// Returns 1 if is , or 0 otherwise. public static byte ToByte(this bool value) { - return (byte)value.ToInt32(); + return value ? 1 : 0; } /// @@ -22,7 +22,7 @@ /// Returns 1 if is , or 0 otherwise. public static short ToInt16(this bool value) { - return (short)value.ToInt32(); + return value.ToByte(); } /// @@ -32,7 +32,7 @@ /// Returns 1 if is , or 0 otherwise. public static int ToInt32(this bool value) { - return value ? 1 : 0; + return value.ToByte(); } /// @@ -42,7 +42,7 @@ /// Returns 1 if is , 0 otherwise. public static long ToInt64(this bool value) { - return value.ToInt32(); + return value.ToByte(); } } }