Enum.GetValues Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

Syntax

Public Shared Function GetValues ( _
    enumType As Type _
) As Array
public static Array GetValues(
    Type enumType
)

Parameters

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.

Exceptions

Exception Condition
ArgumentNullException

enumType is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentException

enumType is not an Enum.

Remarks

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

Examples

The following example illustrates the use of the GetValues method.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

Enum Class

System Namespace