What's the difference between using Flags and FlagsAttribute with an enum?
Flags is simply shorthand for FlagsAttribute. In C#, you can leave the "Attribute" suffix off an attribute when you're applying it to an element.
As for Flags itself, all it does is denote the enum as having flags members. You still have to ensure that the members have values that combine correctly. Some framework functions, such as Enum.ToString, will look for the flags attribute to determine how to interpret the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With