次の方法で共有


CLRInterop.parseClrEnum(String, String) Method

Definition

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent CLRObject instance.

public:
 static System::Object ^ parseClrEnum(System::String ^ _clrEnumTypeName, System::String ^ _enumValues);
public static object parseClrEnum (string _clrEnumTypeName, string _enumValues);
static member parseClrEnum : string * string -> obj
Public Shared Function parseClrEnum (_clrEnumTypeName As String, _enumValues As String) As Object

Parameters

_clrEnumTypeName
String

A string that contains the name or value to convert.

_enumValues
String

A string that contains the name or value to convert.

Returns

The CLRObject instance that contains the specified CLR enumerator values.

Remarks

The _enumValues parameter contains a value, a named constant, or a list of named constants that are delimited by commas (,). One or more blanks spaces can precede or follow each value, name, or comma in _enumValues. If _enumValues is a list, the return value is the value of the specified names combined with a bitwise OR operation.

The following example converts the enumerator value to the string value of Monday and prints the value in the Infolog.

static void Job6(Args _args) 
{ 
    System.DayOfWeek    dayOfWeek; 
    System.Type         dayOfWeekType; 
    dayOfWeek = CLRInterop::parseClrEnum( "System.DayOfWeek", "Monday"); 
    dayOfWeekType = dayOfWeek.GetType(); 
    info( dayOfWeek.ToString() ); 
}

Applies to