nahidjamalli

Lesson #5

Mar 12th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. namespace MyNamespace
  2. {
  3.     class Program
  4.     {
  5.         // Enumeration
  6.         enum MyEnum
  7.         {
  8.             Start = 1,
  9.             Stop = 2,
  10.             Pause = 3,
  11.             End = 2
  12.         }
  13.  
  14.         static void Main()
  15.         {
  16.             MyEnum x = MyEnum.Pause;
  17.             f(x);
  18.         }
  19.  
  20.         static void f(MyEnum a)
  21.         {
  22.             if (a == MyEnum.Start)
  23.             {
  24.                 System.Console.WriteLine("Start");
  25.             }
  26.             else if (a == MyEnum.Pause)
  27.             {
  28.                 System.Console.WriteLine("Pause");
  29.             }
  30.             else if (a == MyEnum.Stop)
  31.             {
  32.                 System.Console.WriteLine("Stop");
  33.             }
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment