Feb 162010
Shh… hear that? It’s the sound of a million developers ripping out their home-grown HasFlag, IsFlagSet, CheckFlag, etc helper methods. Just noticed that in .NET 4 System.Enum now has a built-in HasFlag method. As Forrest Gump would say “Lt. Dan says we don’t have to worry about enum flags no more. That’s good. One less thing.”
There might be performance issues with .HasFlags check: http://connect.microsoft.com/VisualStudio/feedback/details/554908/enum-hasflag-tremendously-bad-performance