In some cases you can use the handy with() statement for that purpose.

One example usages:

final switch (foo) with (MyEnum) {
    ...
}

Okay - the with statement may help in some cases. I'll
have to try it out...



Using an enumeration of class instances isn't a good idea, they are designed mostly for integral built-in types, including chars, etc.


I disagree. If you just think of a class type enum as a class type,
then what you say makes sense.  But if you instead think of it as
a more powerful enum then it can enhance data safety in a program.

-Eric



Reply via email to