Note, this is not a dupe of this question:
Testing if a bitmask has one and only one flag
I need to validate whether or not a bitmask consists of multiple flags. I've come up with this method, but I don't like it a whole lot because of the enumeration and casting.
[Flags]
enum MyFlags { a = 1, b = 2, c = 4, d = 8 }
var flags = Enum.GetValues(typeof(MyFlags)).Cast<MyFlags>();
Console.WriteLine(flags.Any(f => f == (MyFlags.a | MyFlags.c))); //false
Console.WriteLine(flags.Any(f => f == MyFlags.b)); //true