Combining Enums

后端 未结 5 1589
旧巷少年郎
旧巷少年郎 2021-02-03 22:45

Is there a way to combine Enums in VB.net?

5条回答
  •  情书的邮戳
    2021-02-03 23:33

    The key to combination Enums is to make sure that the value is a power of two (1, 2, 4, 8, etc.) so that you can perform bit operations on them (|= &=). Those Enums can be be tagged with a Flags attribute. The Anchor property on Windows Forms controls is an example of such a control. If it's marked as a flag, Visual Studio will let you check values instead of selecting a single one in a drop-down in the properties designer.

提交回复
热议问题