ToObject ( INPUT enum-type-name AS CHARACTER,
INPUT enum-member-name AS CHARACTER )
ToObject ( INPUT enum-type-name AS CHARACTER,
INPUT value AS INT64 )
enum-type-name
The name of an enum type.
enum-member-name
The name of an enum member of the specified enum type. For a flag enum type, this can be a comma-delimited list of enum members.
value
The underlying numeric value of an enum member of the specified enum type. For a flag enum type, this value can represent two or more enum members.
The method returns an error if a member name or numeric value does not correspond to a member of the enum type. The exception to this is that you can pass a value of 0 for a flag enum type even if no member has been explicitly defined for 0.
This code excerpt creates an instance of the user-defined Permission flag enum and assigns vPerm the members Write and Create. Both versions of the final statement have the same result:
Because ToObject( ) returns a weakly typed instance, you must use CAST, as shown in the example above, if you want to assign the method's return value to a variable defined as a specific enum type. To create a strongly typed enum instance, use the GetEnum( ) method.