/// <summary> /// Returns a new Flags instance returns a new Flags instance with the values from <paramref name="flags"/> /// that were not in <paramref name="mask"/> if <paramref name="condition"/> is true, and otherwise returns /// the supplied <paramref name="flags"/>. /// </summary> public static Flags ClearIf(Flags flags, Flags mask, bool condition) { return(condition ? (Flags)(flags & ~mask) : flags); }
/// <summary> /// Returns a new Flags instance with the union of the values from <paramref name="flags"/> and /// <paramref name="mask"/> if <paramref name="condition"/> is true, and otherwise returns a new /// Flags instance with the values from <paramref name="flags"/> that were not in <paramref name="mask"/>. /// </summary> public static Flags SetOnlyIf(Flags flags, Flags mask, bool condition) { return(condition ? flags | mask : (Flags)(flags & ~mask)); }
/// <summary> /// Returns a new Flags instance with the union of the values from <paramref name="flags"/> and /// <paramref name="mask"/> if <paramref name="condition"/> is true, and otherwise returns the /// supplied <paramref name="flags"/>. /// </summary> public static Flags SetIf(Flags flags, Flags mask, bool condition) { return(condition ? flags | mask : flags); }
/// <summary> /// Returns true if all values in the given <paramref name="mask"/> are not set in the current Flags instance. /// </summary> public bool IsNotSet(Flags mask) { return((flags & mask) == 0); }
/// <summary> /// Returns true if at least one of the values in the given <paramref name="mask"/> are set in the current Flags instance. /// </summary> public bool IsAnySet(Flags mask) { return((flags & mask) != 0); }
/// <summary> /// Returns true if all values in the given <paramref name="mask"/> are set in the current Flags instance. /// </summary> public bool IsSet(Flags mask) { return((flags & mask) == mask); }