In Greg O’Lone’s recent blog posting, he discusses the new enumeration enhancements in Xojo 2021r2. One of the enhancements is the ability to use the enumeration as a Constructor which takes an Integer.
I have attempted to duplicate this new feature with the following code:
Enum SomeEnum // placed inside a Module
Foo = 0
Bar = 1
Baz = 2
Var x as New SomeEnum(2) // Using the enumeration as a Constructor which takes an Integer
If x = SomeEnum.Baz then
// x = SomeEnum.Baz
But I get the following error: “Cannot create an instance of enum Module1.SomeEnum with New because it is not a class.
Var x as New SomeEnum(2)”.
I am using the new Xojo version Xojo 2021r2.
I am sure I am doing something wrong here. Can anyone help?