From 87f06202460a5524cf70fbaf1228235485fa7898 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Thu, 6 Jul 2017 14:02:41 -0400 Subject: [PATCH] Resolving warnings --- ICD.Common.Utils/EnumUtils.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ICD.Common.Utils/EnumUtils.cs b/ICD.Common.Utils/EnumUtils.cs index 4591857..8cbf5cf 100644 --- a/ICD.Common.Utils/EnumUtils.cs +++ b/ICD.Common.Utils/EnumUtils.cs @@ -225,6 +225,7 @@ namespace ICD.Common.Utils public static IEnumerable GetFlags(T value) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); return GetValues().Where(e => HasFlag(value, e)); @@ -239,6 +240,7 @@ namespace ICD.Common.Utils public static IEnumerable GetFlagsExceptNone(T value) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); T none = GetNoneValue(); @@ -269,9 +271,11 @@ namespace ICD.Common.Utils public static bool HasFlag(T value, T flag) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); if (!IsEnum(flag)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", flag == null ? "NULL" : flag.GetType().Name), "flag"); return ToEnum(value).HasFlag(ToEnum(flag)); @@ -287,9 +291,11 @@ namespace ICD.Common.Utils public static bool HasFlags(T value, T flags) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); if (!IsEnum(flags)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", flags == null ? "NULL" : flags.GetType().Name), "flags"); return ToEnum(value).HasFlags(ToEnum(flags)); @@ -304,6 +310,7 @@ namespace ICD.Common.Utils public static bool HasSingleFlag(T value) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); return (int)(object)value != (int)(object)GetNoneValue() && !HasMultipleFlags(value); @@ -317,6 +324,7 @@ namespace ICD.Common.Utils public static bool HasMultipleFlags(T value) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); return HasMultipleFlags((int)(object)value); @@ -394,6 +402,7 @@ namespace ICD.Common.Utils public static Enum ToEnum(T value) { if (!IsEnum(value)) +// ReSharper disable once CompareNonConstrainedGenericWithNull throw new ArgumentException(string.Format("{0} is not an enum", value == null ? "NULL" : value.GetType().Name), "value"); return ToEnum((object)value);