C# Type IsEnum
Description
Type IsEnum
gets a value indicating whether the current
Type represents an enumeration.
Syntax
Type.IsEnum
has the following syntax.
public virtual bool IsEnum { get; }
Example
The following example demonstrates how to use the IsEnum property.
// ww w . j a v a2 s . c o m
using System;
public enum Color
{
Red, Blue, Green
}
class TestIsEnum
{
public static void Main()
{
Type colorType = typeof(Color);
Type enumType = typeof(Enum);
Console.WriteLine("Is Color an enum? {0}.", colorType.IsEnum);
}
}
The code above generates the following result.