Open
Description
The following examples do not follow the Remarks section in System.FlagsAttribute:
Define enumeration constants in powers of two, that is, 1, 2, 4, 8, and so on. This means the individual flags in combined enumeration constants do not overlap.
As a result of this invalid configuration, ToString() returns incorrect results because the Flags values use an unsupported configuration, so the behavior is undefined/non-supported.
[Flags]
enum TestEnum
{
A = 3, B = 4
}
[Flags]
enum TestEnum2
{
A = 3, B = 4, C = 5
}
static void Main(string[] args)
{
Console.WriteLine(TestEnum.A|TestEnum.B);
Console.WriteLine(TestEnum2.A|TestEnum2.B);
}
Metadata
Metadata
Assignees
Labels
No labels