What does the [Flags] attribute mean for enums in C#?
Hello, colleagues! I'm learning C# and came across the [Flags] attribute before an enum declaration. I read several articles but still don't fully understand why it's needed.
Here's an example I found:
```csharp
[Flags]
public enum Days
{
None = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 4,
Thursday = 8,
Friday = 16,
Saturday = 32,
Sunday = 64
}
```
I understand that the values are set as powers of two (1, 2, 4, 8...), but I don't understand:
1. What exactly does the [Flags] attribute do? The code compiles without it too.
2. How to properly combine values? I tried writing `Days weekend = Days.Saturday | Days.Sunday;`, but I'm not sure if that's correct.
3. How to then check if a specific day is contained in such a combination? For example, whether Saturday is in the weekend variable?