// Example 1: Setting file access permissions using System; using System.IO; class Program { static void Main() { // Combine read and write permissions var access = FileAccess.Read | FileAccess.Write; // Use the access flag in a file stream using (var stream = new FileStream("example.txt", FileMode.OpenOrCreate, access)) { // Do something with the file } } } // Example 2: Bit field enum with FlagsAttribute using System; [Flags] enum MyEnum { None = 0, Flag1 = 1 << 0, // bit 0 Flag2 = 1 << 1, // bit 1 Flag3 = 1 << 2, // bit 2 Flag4 = 1 << 3, // bit 3 } class Program { static void Main() { // Combine multiple flags using bitwise OR var flags = MyEnum.Flag1 | MyEnum.Flag3; // Check if a specific flag is set using bitwise AND if ((flags & MyEnum.Flag2) == MyEnum.Flag2) { Console.WriteLine("Flag2 is set"); } } }The System.FlagsAttribute is part of the System.Runtime.CompilerServices package.