G
Guest
Hi All... I am a beginning .NET developer and am using C# with ASP.NET. I am
having trouble with switch statements, can anyone help?
When I run the below code, I receive an error "Compiler Error Message:
CS1519: Invalid token 'switch' in class, struct, or interface member
declaration"
<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(Object Sender, EventArgs e);
string FirstName = "David";
switch (FirstName) {
case "David":
Response.Write("David");
break;
case "Michael":
Response.Write("Michael");
break;
default:
Response.Write("Not David or Michael");
break;
}
}
</script>
<html><body>
</html></body>
having trouble with switch statements, can anyone help?
When I run the below code, I receive an error "Compiler Error Message:
CS1519: Invalid token 'switch' in class, struct, or interface member
declaration"
<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(Object Sender, EventArgs e);
string FirstName = "David";
switch (FirstName) {
case "David":
Response.Write("David");
break;
case "Michael":
Response.Write("Michael");
break;
default:
Response.Write("Not David or Michael");
break;
}
}
</script>
<html><body>
</html></body>