Language Basics C# Book

We can use Flag enum value to do bitwise operation.
using System;
[Flags]
public enum WeekDay{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
class Test
{
static void Main()
{
WeekDay day = WeekDay.Saturday | WeekDay.Sunday;
Console.WriteLine(day);
}
}
The output:
Tuesday, Sunday
Check the combination

using System;
[Flags]
public enum WeekDay
{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
class Test
{
static void Main()
{
WeekDay day = WeekDay.Saturday | WeekDay.Sunday;
if ((day & WeekDay.Saturday) != 0)
{
Console.WriteLine("it is a weekend.");
}
}
}
The output: