![]() Feedback case 65327 - Moving binary enumeration out of a module causes a syntax error when project is run. My suggestion for a fix would be to have the IDE put all those binary enum outside a module into a new module just for them. If you copy & paste or move one outside a module, you will run into weird compilation errors. For some reason the value property doesn't even show in auto complete: Feedback case 65358 - Binary Enumeration: Value property does not auto complete.īinary Enums can only be defined in a Module, since the IDE can put the class there. Feedback case 65357 - Binary Enumeration: Add Operator_Add. The compiler will query the values as integer, do the add and then use Operator_Convert to make a new enum object. Fruits.Apple + Fruits.Grape, this will fail. If you think about doing a + on the enum, e.g. But you can extend the enum with methods in a module. The class picker won't find the enum as class name. And by the way, although this is a class, you can't subclass it. Of course you may just do the Operator_Convert instead, but I would prefer a simpler class without the Value computed property. Make the constructor also public, so we can define our own methods doing "new Fruits(123)" passing any value ( Feedback case 65359 - Binary Enumeration: Make constructor public). But since we got the class, why does it need an InternalValue private property? Please just use value and let us assign it ( Feedback case 65356 - Binary Enumeration: make value regular property). As you see the Contains function is just another way to do AND operator.Ĭould this be done better? Yes, of course I wold have wished this would have been implemented as part of the compiler using an integer and not a class. And with Operator_Convert the compiler can query the integer value or create a new enum with an integer value. You can do OR, AND and XOR operators, which call the methods. ![]() That includes both left and right variants, so the compiler always has one to call. Various operators are defined to do math on the value properties directly. Then the internal value is stored in a private integer property and can only be read using the value property. As you see, this is a class with some shared factory methods to create new instances for the given names.
0 Comments
Leave a Reply. |