Odd issue with Switch-Case statement in Code behind page.

G

Guy Noir

Hello again. I'm assuming I'm doing something dumb here....

When I try and add a default: case to my switch statement, I get an
error that says "Error 1 Syntax error, '(' expected" and the red
squiggly is under the : after the word default. Can anyone see my silly
error? Thanks for the extra set of eyes!

-Guy

Here is the code for the entire method:

protected int[] GenerateClassfulSubnetMask(IPClasses ipClass)
{
switch (ipClass)
{
case IPClasses.ClassA:
int[] subnetMask = { 255, 0, 0, 0 };
return subnetMask;
case IPClasses.ClassB:
int[] subnetMask = { 255, 255, 0, 0 };
return subnetMask;
case IPClasses.ClassC:
int[] subnetMask = { 255, 255, 255, 0 };
return subnetMask;
case default:
break;
}
// If we reach here, something went wrong.....
int[] subnetMask = { 0, 0, 0, 0 };
return subnetMask;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top