It seems to me that MyClass has access to MyStaticClass, and
thus should
also have access to B. If this is the case, why is MyClass
using an A
instead of a B?
No, they are sadly not part of the same file / module.
The // ---- should symbolize that. :D
One option might be to use alias A = B; This would ensure the
two enums
are always the same.
Yes that is a good idea.
The only problem is, that he have doc comments on both enums.
So, others which would use MyClass must then look into
MyStaticClass to figure out what is supported. :/ That would be a
bit annoying.
Last ditch, I would say option #2 is the best. It's not safe,
in that
if one enum changes and the other does not, the cast will
blithely
ignore that and use the same uint value. It is however
efficient, as it
is a simple reinterpretation of the bits.
Okay, I hoped for that.
Would it be safe if I store A into an uint and cast this to B? Or
is that the explicit variant what the compiler do implicit, if I
use B b = cast(B) this.a; ?