Example #1
0
        /// <summary>
        /// Determines if the enumeration value is defined or contains a valid combination of flags.
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <returns>true if the value is defined or a valid combination of flags; otherwise, false.</returns>
        public static bool IsDefined(this Enum value)
        {
            Type enumType = value.GetType();

            if (value.HasFlags(enumType))
            {
                return(value.AreFlagsDefined(enumType));
            }
            else
            {
                return(Enum.IsDefined(enumType, value));
            }
        }