M
Mobile Application Developer (MAD)
I think that Microsoft should add a new feature to [Flags] so if values are
not specified in enum it defaults to sequence, {1, 2, 4, ... 2^(N-1)} where
N is largest number of bits allowed in an enum. A '#pragma' directive can be
added to displable.
Examples;
/// 1) NO CHANGE IN SEMANTICS
#pragma disable-flags
[Flags]
enum States { A, B, C, D}
/// 2) NO CHANGE IN SEMANTICS
[Flags]
enum States { A=1, B, C, D}
/// CHANGE IN SEMANTICS -- A = 1, B = 2, C = 4, D = 8
[Flags]
enum States { A, B, C, D}
/// CHANGE IN SEMANTICS -- A = 4, B = 8, C = 16, D = 32
[Flags:4]
enum States { A, B, C, D}
Would this not be very nice to have? How do I ask MS if they would add it to
languagge?
not specified in enum it defaults to sequence, {1, 2, 4, ... 2^(N-1)} where
N is largest number of bits allowed in an enum. A '#pragma' directive can be
added to displable.
Examples;
/// 1) NO CHANGE IN SEMANTICS
#pragma disable-flags
[Flags]
enum States { A, B, C, D}
/// 2) NO CHANGE IN SEMANTICS
[Flags]
enum States { A=1, B, C, D}
/// CHANGE IN SEMANTICS -- A = 1, B = 2, C = 4, D = 8
[Flags]
enum States { A, B, C, D}
/// CHANGE IN SEMANTICS -- A = 4, B = 8, C = 16, D = 32
[Flags:4]
enum States { A, B, C, D}
Would this not be very nice to have? How do I ask MS if they would add it to
languagge?