Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public enum Color { Red, Green, Blue }
- public class Example
- {
- public static void Main()
- {
- Color c = (Color) (new Random()).Next(0, 3);
- switch (c)
- {
- case Color.Red:
- Console.WriteLine("The color is red");
- break;
- case Color.Green:
- Console.WriteLine("The color is green");
- break;
- case Color.Blue:
- Console.WriteLine("The color is blue");
- break;
- default:
- Console.WriteLine("The color is unknown.");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement