From 9b1ddf41d290483cc87f78d9f9514e9097640b45 Mon Sep 17 00:00:00 2001 From: Jack Kanarish Date: Thu, 3 May 2018 11:56:09 -0400 Subject: [PATCH] add bool and ushort extensions --- ICD.Common.Utils/Extensions/BoolExtensions.cs | 10 ++++++++++ ICD.Common.Utils/Extensions/UshortExtensions.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 ICD.Common.Utils/Extensions/BoolExtensions.cs create mode 100644 ICD.Common.Utils/Extensions/UshortExtensions.cs diff --git a/ICD.Common.Utils/Extensions/BoolExtensions.cs b/ICD.Common.Utils/Extensions/BoolExtensions.cs new file mode 100644 index 0000000..53c2ee7 --- /dev/null +++ b/ICD.Common.Utils/Extensions/BoolExtensions.cs @@ -0,0 +1,10 @@ +namespace ICD.Common.Utils.Extensions +{ + public static class BoolExtensions + { + public static ushort ToUshort(this bool b) + { + return b ? (ushort)1 : (ushort)0; + } + } +} \ No newline at end of file diff --git a/ICD.Common.Utils/Extensions/UshortExtensions.cs b/ICD.Common.Utils/Extensions/UshortExtensions.cs new file mode 100644 index 0000000..e31c463 --- /dev/null +++ b/ICD.Common.Utils/Extensions/UshortExtensions.cs @@ -0,0 +1,10 @@ +namespace ICD.Common.Utils.Extensions +{ + public static class UshortExtensions + { + public static bool ToBool(this ushort u) + { + return u != 0; + } + } +} \ No newline at end of file