Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Edabit
- {
- class Program
- {
- enum Month { January = 1, February, March, April, May, June, July, August, September, October, November, December };
- static void Main(string[] args)
- {
- int input = Convert.ToInt32(Console.ReadLine());
- Month month = (Month)input; /* creating 'month' object and get enum element by his value */
- if (Enum.IsDefined(typeof(Month), input)) Console.WriteLine(month); /* verify if input is correpsonding to enum's value */
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement