How do I convert C# Enums to Lists in ACT Console (IronPython)?
Ayush Kumar
Member, Moderator, Employee Posts: 450
✭✭✭✭
There are a lot of C# Enums in Mechancial ACT Console. How do I convert them into lists so that one can loop over Enums?
Tagged:
0
Answers
-
Using functions
Enum.GetValues
andclr.GetClrType(<Enum>)
Enum.GetValues
returns anArray
type -System.Array
To convert it into list use -
list()
Example code:
import clr from System import Enum for element_type in list(Enum.GetValues(clr.GetClrType(ElementTypeEnum))): print element_type
6