Is there a way to make a new enum from an array of `String`s?

Calin Baenen - Mar 1 '21 - - Dev Community

I know there's a way to convert a String[] to a list of <EnumType>[], but that's not what I want.

For ease of creation, I need a way to convert a list of tokens to a new enum.

E.g.

String[] strVals = {"MY_FIRST_CONSTANT", "MY_SECOND_CONSTANT"}
Emum ValCollection = /* Way to convert String[] to Enum. */
Enter fullscreen mode Exit fullscreen mode

Thanks!
Cheers!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .