CSharp examples for System:Enum
Set Enum Flags
using System.Linq; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Globalization; using System;/*from www . ja v a2 s.c o m*/ public class Main{ public static T SetFlags<T>(this Enum current, T setflags, bool onoff) { return (onoff ? (T)(object)(((int)(object)current | (int)(object)setflags)) : (T)(object)(((int)(object)current & ~(int)(object)setflags))); } }