- Lowell George
public enum MyEnum { val1, val2, val3, val4 }
MyEnum Methods
Compiler |
Global |
Instance/Shared |
Description |
- |
- |
Constructor for the 'MyEnum' class to initialize with a MyEnum value | |
- | - | MyEnum() | Constructor for the 'MyEnum' class to initialize with an int value |
- | - | MyEnum() | Constructor for the 'MyEnum' class to initialize with a string value |
- | - | Enum() | Shared method to return the enumeration value that matches the specified index |
- | - | Enum() | Shared method to return the enumeration value that matches the specified name |
CompilerEnumStr() | - |
Str() | Returns a string representation of the MyEnum value ('val1', 'val2', ... ) |
CompilerEnumIndex() | - | Index() | Returns the one based internal index for the enumeration value (val1=1,val2=2, val3=3,val4=4) |
CompilerInc() | - | Inc() | Increments the enumeration value based on internal index and returns new enum value |
CompilerDec() | - | Dec() | Decrements the enumeration value based on internal index and returns new enum value |
MyEnum Constants
Constant Data Item | Data Type | Value |
MyEnum.MaxValue | MyEnum | val4 |
MyEnum.MinValue | MyEnum | val1 |
MyEnum.NumValues | int | 4 |
Derived Classes
NONE
See Also
Class Hierarchy, Primitive Framework, int, float, string, bool
public method MyEnum(MyEnum InitValue = val1)
Parameters
InitValue
Initial value for the MyEnum object, with a default of val1 (first value in list)
Return Value
None
Description
This is one of the constructors for the MyEnum class, invoked automatically by the VM during dynamic allocation of a MyEnum object, if the constructor arguments match this method. It is only available for dynamic allocation and not for initialization of bool variables.
This constructor takes a MyEnum enumeration value as a parameter to initialize the object. The default value is the first enumeration in the list ('val1' in this case) if nothing is passed in.
MyEnum Class
public method MyEnum(int InitIndex)
Parameters
InitIndex
Initial index value for the bool object
Return Value
None
Description
This is one of the constructors for the MyEnum class, invoked automatically by the VM during dynamic allocation of a MyEnum object, if the constructor arguments match this method. It is only available for dynamic allocation and not for initialization of bool variables.
This constructor takes an integer value as a parameter to initialize the object, which represents the index of the enumeration value. For the fictional MyEnum class, the index must be between 1 (val1) and 4 (val4). If the index value is not valid, the enumeration object is set with the first enumeration value (val1 in this case).
MyEnum Class
public method MyEnum(string InitEnumText)
Parameters
InitEnumText
String representing one of the enumeration values
Return Value
None
Description
This is one of the constructors for the MyEnum class, invoked automatically by the VM during dynamic allocation of a MyEnum object, if the constructor arguments match this method. It is only available for dynamic allocation and not for initialization of bool variables.
This constructor takes a string value as a parameter to initialize the object, which represents the text/name of the enumeration value. For the fictional MyEnum class, the text must be 'val1, 'val2, 'val3' or 'val4'. If the string is not valid, the enumeration object is set with the first enumeration value (val1 in this case).
MyEnum Class
public method<MyEnum> shared Enum(int EnumIndex)
Parameters
EnumIndex
Enumeration index value
Return Value
Returns enumeration value that matches the specified index
Description
This shared method takes a one based enumeration index and returns the corresponding enumeration value corresponding to the index. For the MyEnum class, the index must be between 1 (val1) and 4 (val4). If the index is not valid, it returns the first enumeration value (val1 in this case)..
MyEnum Class
public method<MyEnum> shared Enum(string EnumText)
Parameters
EnumText
String representing one of the enumeration values
Return Value
Returns enumeration value that matches the specified enumeration text
Description
This shared method takes an enumeration name and returns the corresponding enumeration value corresponding to the text. For the MyEnum class, the valid names are 'val1', 'val2', 'val3' and 'val4'. If the text does not match any of the valid items for the enumeration, the first enumeration value is returned (val1 in this case).
MyEnum Class
public method<string> Str()
Parameters
None
Return Value
Returns the string representation of the MyEnum value
Description
This instance method returns the string representation of the internal MyEnum value. If the value is val1, the method returns "val1" and if val2, it returns "val2" and so on.
MyEnum Class
public method<string> compiler CompilerEnumStr(MyEnum Value)
Parameters
Value
MyEnum value to be converted to a string
Return Value
Returns the string representation of the MyEnum value
Description
This compiler method returns the string representation of the MyEnum value. If the value is val1, the method returns "val1" and if val2, it returns "val2" and so on.
This method can be used dynamically during the compile process at the module level, class level and inside compiler methods. It can also be used within expressions in non-compiler methods. When the expression is processed by the compiler, the compiler method is invoked and the result is treated as a constant within the expression.
Compiler Method
public method<int> Index()
Parameters
None
Return Value
Returns the one based index of the MyEnum value
Description
This instance method returns the one based index of the internal MyEnum value. If the value is val1, the index is one, if val2, the index is two and so on. The max index is four and is associated with the last value in the list, val4
MyEnum Class
public method<int> compiler CompilerEnumIndex(MyEnum Value)
Parameters
Value
MyEnum value to get index of
Return Value
Returns the one based index of the MyEnum value
Description
This global method returns the one based index of the internal MyEnum value. If the value is val1, the index is one, if val2, the index is two and so on. The max index is four and is associated with the last value in the list, val4.
This method can be used dynamically during the compile process at the module level, class level and inside compiler methods. It can also be used within expressions in non-compiler methods. When the expression is processed by the compiler, the compiler method is invoked and the result is treated as a constant within the expression.
Compiler Method
public method<MyEnum> Inc()
Parameters
None
Return Value
Returns the incremented MyEnum value
Description
This instance method increments the internal MyEnum value based on index and returns the result. If the internal bool value is val1, the incremented value becomes val2, and so on. If the MyEnum value is the highest value in the list (val4), the increment operation will cause an OverflowException to be fired.
This method modifies the internal MyEnumm object.
MyEnum Class
public method<MyEnum> compiler CompilerInc(MyEnum ref Value)
Parameters
Value
Reference to MyEnum value to be incremented
Return Value
Returns the incremented MyEnum value
Description
This global method increments the specified MyEnum value based on index and returns the result. If the MyEnum value is val1, the incremented value becomes val2, and so on. If the MyEnum value is the highest value in the list (val4), the increment operation will not be performed and a value of true will be returned.
This method modifies the source bool object.
This method can be used dynamically during the compile process at the module level, class level and inside compiler methods. It can also be used within expressions in non-compiler methods. When the expression is processed by the compiler, the compiler method is invoked and the result is treated as a constant within the expression.
Compiler Method
public method<MyEnum> Dec()
Parameters
None
Return Value
Returns the decremented MyEnum value
Description
This instance method decrements the internal MyEnum value based on index and returns the result. If the MyEnum value is val4, the decremented value becomes val3, and so on. If the MyEnum value is already at the min value (first value in list), the decrement operation will cause an OverflowException to be fired.
This method modifies the internal MyEnum object.
MyEnum Class
public method<MyEnum> compiler CompilerDec(MyEnum ref Value)
Parameters
Value
MyEnum value to be decremented
Return Value
Returns the decremented MyEnum valu
Description
This global method decrements the specified MyEnum value based on index and returns the result. If the MyEnum value is val4, the decremented value becomes val3, and so on. If the MyEnum value is already at the min value (first value in list), the decrement operation will cause an OverflowException to be fired.
This method modifies the source MyEnum object.
This method can be used dynamically during the compile process at the module level, class level and inside compiler methods. It can also be used within expressions in non-compiler methods. When the expression is processed by the compiler, the compiler method is invoked and the result is treated as a constant within the expression.
Compiler Method