Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
 /// <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));
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 /// <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);
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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);
 }