Пример #1
0
 /// <summary>
 /// Sets flag state on enum.
 /// Please note that enums are value types so you need to handle the RETURNED value from this method.
 /// Example: myEnumVariable = myEnumVariable.SetFlag(CustomEnumType.Value1, true);
 /// </summary>
 public static T SetFlag <T>(this Enum type, T enumFlag, bool value)
 {
     return(value ? type.AddFlag(enumFlag) : type.RemoveFlag(enumFlag));
 }