Пример #1
0
        static void Main(string[] args)
        {
            Volume myVolume = Volume.Medium;

            switch (myVolume)
            {
                case Volume.Low:
                    Console.WriteLine("The volume is low.");
                    break;
                case Volume.Medium:
                    Console.WriteLine("The volume is medium.");
                    break;
                case Volume.High:
                    Console.WriteLine("The volume is high.");
                    break;
            }

            Console.WriteLine("Meat.Rare = {0}", Meat.Rare.ToString());
            Console.WriteLine("Meat.Medium = {0}", Meat.Medium);
            Console.WriteLine("Meat.WellDone = {0}", Meat.WellDone);

            EnumTricks enumTricks = new EnumTricks();
            enumTricks.ListEnumByName();
            enumTricks.ListEnumByValue();

            CarOptions options = CarOptions.SunRoof | CarOptions.FogLights;
            Console.WriteLine(options);
            Console.WriteLine((int)options);

            CarOptions2 options2 = CarOptions2.SunRoof | CarOptions2.FogLights;
            Console.WriteLine(options2);
            Console.WriteLine((int)options2);

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Volume myVolume = Volume.Medium;

            switch (myVolume)
            {
            case Volume.Low:
                Console.WriteLine("The volume is low.");
                break;

            case Volume.Medium:
                Console.WriteLine("The volume is medium.");
                break;

            case Volume.High:
                Console.WriteLine("The volume is high.");
                break;
            }

            Console.WriteLine("Meat.Rare = {0}", Meat.Rare.ToString());
            Console.WriteLine("Meat.Medium = {0}", Meat.Medium);
            Console.WriteLine("Meat.WellDone = {0}", Meat.WellDone);

            EnumTricks enumTricks = new EnumTricks();

            enumTricks.ListEnumByName();
            enumTricks.ListEnumByValue();

            CarOptions options = CarOptions.SunRoof | CarOptions.FogLights;

            Console.WriteLine(options);
            Console.WriteLine((int)options);

            CarOptions2 options2 = CarOptions2.SunRoof | CarOptions2.FogLights;

            Console.WriteLine(options2);
            Console.WriteLine((int)options2);

            Console.ReadKey();
        }