OpenNETCF Smart Device Framework 2.3
Retrieves an array of the names of the constants in a specified enumeration.

Namespace:  OpenNETCF
Assembly:  OpenNETCF (in OpenNETCF.dll) Version: 2.3.0.0

Syntax

C#
public static string[] GetNames(
	Type enumType
)
Visual Basic (Declaration)
Public Shared Function GetNames ( _
	enumType As Type _
) As String()
Visual Basic (Usage)
Dim enumType As Type
Dim returnValue As String()

returnValue = Enum2.GetNames(enumType)
Visual C++
public:
static array<String^>^ GetNames(
	Type^ enumType
)
J#
public static String[] GetNames(
	Type enumType
)
JScript
public static function GetNames(
	enumType : Type
) : String[]
JavaScript
OpenNETCF.Enum2.GetNames = function(enumType);

Parameters

enumType
Type: System..::.Type
An enumeration type.

Return Value

A string array of the names of the constants in enumType. The elements of the array are sorted by the values of the enumerated constants.

Examples

The follow example shows how to enumerate the members of the System.DayOfWeek enumeration by adding them to a ComboBox:-
CopyC#
[Visual Basic]
            Dim thisDOW As New DayOfWeek
            For Each thisDOW In OpenNETCF.Enum.GetValues(Type.GetType("System.DayOfWeek"))
                ComboBox1.Items.Add(thisDOW)
            Next
CopyC#
[C#]
            foreach(DayOfWeek thisdow in OpenNETCF.Enum.GetValues(typeof(DayOfWeek)))
            {
                comboBox1.Items.Add(thisdow);
            }

Exceptions

ExceptionCondition
System..::.ArgumentExceptionenumType parameter is not an System.Enum

See Also