Array Of Enum Names C# with Example



Array Of Enum Names C# with Example

 	using System;

	namespace CSharpIntermediateConstructsEnum
	{
		enum MonthName { Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec }
		
		class ArrayOfEnumNames
		{
			static void Main(string[] args)
			{
				MonthName thisMonth = MonthName.Jan;
				string[] months = Enum.GetNames(thisMonth.GetType());
				
				foreach(string month in months)
				Console.Write("{0}\t",month);
			}
		}
	}
 

0 Comment's

Comment Form

Submit Comment