C# Type GetEnumValues
Description
Type GetEnumValues
returns an array of the values of the
constants in the current enumeration type.
Syntax
Type.GetEnumValues
has the following syntax.
public virtual Array GetEnumValues()
Returns
Type.GetEnumValues
method returns An array that contains the values. The elements of the array are sorted by
the binary values (that is, the unsigned values) of the enumeration constants.
Example
/*from w ww . j a v a 2 s. c o m*/
using System;
enum ABC{A,B,C}
public class MainClass{
public static void Main(String[] argv){
ABC a = ABC.A;
System.Console.WriteLine(a.GetType().GetEnumValues());
}
}
The code above generates the following result.