diff --git a/ICD.Common.Utils/EnumUtils.cs b/ICD.Common.Utils/EnumUtils.cs index 17354f1..528cd03 100644 --- a/ICD.Common.Utils/EnumUtils.cs +++ b/ICD.Common.Utils/EnumUtils.cs @@ -243,6 +243,21 @@ namespace ICD.Common.Utils return (T)Enum.ToObject(typeof(T), output); } + /// + /// Gets the overlapping values of the given enum flags. + /// + /// + /// + /// + /// + public static T GetFlagsIntersection(T a, T b) + { + int aInt = (int)(object)a; + int bInt = (int)(object)b; + + return (T)Enum.ToObject(typeof(T), aInt & bInt); + } + /// /// Gets all of the set flags on the given enum. ///