Feature request:....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ozbear

    #16
    Re: Feature request:....

    On Tue, 14 Oct 2003 11:11:25 +0100, Jon Skeet [C# MVP]
    <skeet@pobox.co m> wrote:
    [color=blue]
    >ozbear <ozbear@no.bigp ond.spam.com> wrote:[color=green]
    >> The documentation does seem to be incorrect. I am using the 1.1
    >> framework, if that matters, and given the declaration:
    >>
    >> enum answer {yes, no maybe};
    >>
    >> i can declare a variable of type -answer- and use the C# OR
    >> operator...
    >>
    >> answer test = answer.yes | answer.no;
    >>
    >> According to the doco, I need the [Flags] attribute applied to my
    >> -answer- enumeration, yet the C# compiler accepts the above test =
    >> assignment without complaint. In other words...the presence or
    >> absence of [Flags] makes no difference to the /assignment/.
    >>
    >> I accept that it will affect other things like ToString(), etc.[/color]
    >
    >It should work as per the above according to sectino 14.10.2 of the
    >ECMA spec.
    >
    >The documentation you were talking about is the FlagsAttribute remarks,
    >presumably? If so, it's quite an interesting case - it's up to a
    >language to decide what it allows, so I don't think the FlagAttribute
    >documentatio n should really be talking about that at all. What it
    >could/should be talking about is that when [Flags] is applied, bitwise
    >operations are *expected* to give useful results (whereas they may not
    >otherwise). A language *could* decide to only allow bitwise operations
    >on enumerations which are marked with the [Flags] attribute, of course.
    >
    >--[/color]

    Jon,
    Yes, it was in the FlagsAttribute section of the documentation.
    I haven't located anything specifically for [Flags]. I also note
    that the doco uses the word "OR" rather than the C# "|" operator so
    perhaps its remarks are Visual Basic oriented. I don't do VB so
    I haven't tried.

    Regards, Oz

    Comment

    • Stoyan Damov

      #17
      Re: Feature request:....

      > I also note[color=blue]
      > that the doco uses the word "OR" rather than the C# "|" operator so
      > perhaps its remarks are Visual Basic oriented. I don't do VB so
      > I haven't tried.[/color]

      LOL:))) You made my day:))))))))))


      Comment

      Working...