c# - Is flags attribute necessary? -
i found or without flags attributes, can bit operation if defined following enum
enum testtype { none = 0x0, type1 = 0x1, type2 = 0x2 }
i wondering why need flags attribute?
c# treat them same either way, c# isn't consumer:
propertygrid
render differently allow combinationsxmlserializer
accept / reject delimited combinations based on flagenum.parse
likewise (from string), , enum's.tostring()
behave differently- lots of other code displays or processes value treat them differently
more importantly, though, expression of intent other developers (and code); this meant treated combinations, not exclusive values.
Comments
Post a Comment