Of course it fails.  Why would you ever expect otherwise?

-- arlie


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of John Elliot
Sent: Friday, April 09, 2004 6:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Enumeration bounds checking?

This fails at compile-time:

  public enum MyEnum : short {
    ValueOne = 0,
    ValueTwo = 1,
  }

  Console.WriteLine((MyEnum)Int32.MaxValue);

John.

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to