Page MenuHomeFeedback Tracker

No reverse conversion for EnumToString
Closed, ResolvedPublic

Description

Currently there isn't a reverse conversion for EnumToString, which would convert the string back to the respective type variable value. Could we get this function attached as additional information, added to the typename class?

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Additional Information
static int StringToEnum(typename e, string enumName)
{
    int count = e.GetVariableCount();
    int value;
   
    for (int i = 0; i < count; i++)
    {
        if (e.GetVariableType(i) == int && e.GetVariableValue(null, i, value) && e.GetVariableName(i) == enumName)
        {
            return value;
        }
    }
    return -1;
}

Event Timeline

Geez changed the task status from New to Need More Info.Nov 19 2019, 10:35 AM
Geez added a subscriber: Geez.
This comment was removed by Geez.
Geez changed the task status from Need More Info to New.Nov 19 2019, 10:46 AM
Geez changed the task status from New to Assigned.Nov 19 2019, 1:05 PM
Geez closed this task as Resolved.Nov 19 2019, 1:10 PM
Geez claimed this task.

Hello OfficialWardog.
The function has been added internally and will appear in one of the future updates.
Regards,
Geez