What's the difference between using Flags and FlagsAttribute with an enum?
C# Flags vs FlagsAttribute
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.
© 2022 - 2024 — McMap. All rights reserved.
1 << 0
(1),1 << 1
(2),1 << 2
(4), etc. – Hausner