Enum.GetValues Method

July 28, 2014

Retrieves an array of the values of the constants in a specified enumeration.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static Array GetValues(
	Type enumType
)

Parameters

enumType
Type: System.Type
An enumeration type.

Return Value

Type: System.Array
An array that contains the values of the constants in enumType. The elements of the array are sorted by the binary values of the enumeration constants.

ExceptionCondition
ArgumentNullException

enumType is null.

ArgumentException

enumType is not an Enum.

The elements of the array are sorted by the binary values of the enumeration constants (that is, by their unsigned magnitude).

The following example illustrates the use of the GetValues method.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2014 Microsoft