Shouldn't it be
(short)Coin.Penny + (short)Coin.Nickel
??
After all, which enumerated value would represent the sum before the cast
was executed?
Just a guess,
Richard
jpo wrote:
> Hi list,
> the following example code from TiC# does not compile with mcs:
>
> using System;
>
> class EnumTest {
> enum Coin: short {
> Penny = 1,
> Nickel = 5,
> Dime = 10,
> Quarter = 25,
> Dollar = 100
> }
>
> public static void Main ()
> {
> short change = (short)(Coin.Penny + Coin.Nickel);
> Console.WriteLine (change);
> }
> }
>
> Question: is this a bug in mcs or a bug in the book? What does csc do?
>
> Thanks in adance
> Joerg
>
> _______________________________________________
> Mono-list maillist - [EMAIL PROTECTED]
> http://lists.ximian.com/mailman/listinfo/mono-list
--
This communication is intended for the addressee(s) and may contain
confidential and legally privileged information. We do not waive
confidentiality or privilege by mistransmission. If you have received
this communication in error, any use, dissemination, printing or copying
is strictly prohibited; please destroy all electronic and paper copies and
notify the sender immediately.
_______________________________________________
Mono-list maillist - [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list