problem putting enum in page_load

  • Thread starter Thread starter tony collier
  • Start date Start date
T

tony collier

I have the following in one of my .aspx pages:

.....

<script runat="server">

enum bookstores

{
Amazon,
Blackwells,
ComputerManuals,
ComputerBooks
};

void Page_Load(Object sender, EventArgs e)

{


// DECLARE VARIABLES

.....

}

</script>


can someone tell me why the above works fine, yet if i put the enum
declaration IN Page_Load function above // DECLARE VARIABLES I get:


Compiler Error Message: CS1513: } expected

Line 10: void Page_Load(Object sender, EventArgs e)
Line 11:
Line 12: {
Line 13:
Line 14: enum bookstores


error on line 12 ?


Thanks to anyone who can throw light on this
 
Enum is one value type in .NET (inherits from System.Enum). Types are
declared separately of their usage meaning you can consume / use the type
inside the method, but you declare it outside the method, just as class or
any other type would be. They are declared at namespace level and used as
class/member level.
 
Back
Top