[Mono-list] enum broken

Paolo Molaro lupus@ximian.com
Sun, 7 Apr 2002 11:57:49 +0200


On 04/07/02 Jonathan Stowe wrote:
> This really doesn't do what it should :
> 
>    class Test
>    {
>      enum Zub
>      {
>         Foo = 99,
>         Bar,
>         Baz
>       }
> 
>       static void Main()
>       {
>          System.Console.WriteLine("Foo : {0}", Zub.Foo);
>          System.Console.WriteLine("Bar : {0}", Zub.Bar);
>          System.Console.WriteLine("Baz : {0}", Zub.Baz);
> 
>        }
>    }
> 
> Producing :
> 
> Foo : Foo
> Bar : Bar
> Baz : Baz
> 
> Which really isn't right - this for any combination of assignment.

This is the expected behavior, the test compiles and runs as it should.
If you want to know the integer value, use a cast: (int)Zub.Foo.

> On a side note, is it better than I send these things here or should I be
> sending them through bugzilla.ximian.com or indeed both ?

If you use bugzilla there are less chances your bug will be lost.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better