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

Discussion in 'ASP .Net' started by Guy Noir, Nov 2, 2006.

  1. Guy Noir

    Guy Noir Guest

    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;
    }
     
    Guy Noir, Nov 2, 2006
    #1
    1. Advertising

  2. Chris Fulstow, Nov 2, 2006
    #2
    1. Advertising

  3. Guy Noir

    Guy Noir Guest

    Guy Noir, Nov 2, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vic

    switch case statement

    vic, Mar 3, 2004, in forum: Java
    Replies:
    9
    Views:
    5,851
  2. Joe Stevenson

    case/switch statement?

    Joe Stevenson, Jun 11, 2005, in forum: Python
    Replies:
    28
    Views:
    1,062
    Roy Smith
    Jun 23, 2005
  3. Phoe6
    Replies:
    12
    Views:
    609
    Gordon Burditt
    Feb 28, 2005
  4. Switch case statement

    , Jan 2, 2007, in forum: C Programming
    Replies:
    7
    Views:
    387
    Keith Thompson
    Jan 3, 2007
  5. John
    Replies:
    22
    Views:
    728
    James Kanze
    Apr 13, 2007
Loading...

Share This Page