What Does the [Flags] Attribute Really Do?

前端 未结 6 1222
闹比i
闹比i 2020-12-06 03:58

What does applying [Flags] really do?

I know it modifies the behavior of Enum.ToString, but does it do anything else? (e.g. Different compiler or runtime behavior, e

6条回答
  •  执笔经年
    2020-12-06 04:35

    If you ask what it does under the hood, as far as I know, it changes the ToString() method, nothing other.

    Under .Net 4 you have the HasFlags-method to check for specific flags. If I interpret msdn right, you have to use the flags-attribute for using this method. But I have not tried it.

提交回复
热议问题