Enum Get Underlying Type C# with Example



Enum Get Underlying Type C# with Example

 	using System;

	namespace CSharpIntermediateConstructsEnum
	{
		enum MonthName { Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec }
		
		class EnumGetUnderlyingType
		{
			static void Main(string[] args)
			{
				MonthName thisMonth = MonthName.Jan;
				Console.WriteLine("Enum Type: {0}", Enum.GetUnderlyingType(thisMonth.GetType()));
			}
		}
	}
 

0 Comment's

Comment Form

Submit Comment