Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How To Write Or In Switch Case

How To Write Or In Switch Case

Scheduled Pinned Locked Moved ASP.NET
tutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ais07
    wrote on last edited by
    #1

    Hi There, I Want to know how to write or in switch case. For Example I Had written Like this case "A" || "B" || "C": Even I tried With : and also with , Can anybody tell me how to do this. Thanks.

    Y 1 Reply Last reply
    0
    • A ais07

      Hi There, I Want to know how to write or in switch case. For Example I Had written Like this case "A" || "B" || "C": Even I tried With : and also with , Can anybody tell me how to do this. Thanks.

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      switch(something)
      {
      case A:
      case B:
      case C:
      DoSomething():
      break;
      case D:
      DoSomethingELse();
      break;
      case E:
      DoOtherThings();
      goto case D;
      default:
      DoDefault();
      break;
      }

      The first case A,B and C is OR, Case E is and and between E and D. http://msdn.microsoft.com/en-us/library/06tc147t(VS.71).aspx[^]

      Yusuf May I help you?

      A 1 Reply Last reply
      0
      • Y Yusuf

        switch(something)
        {
        case A:
        case B:
        case C:
        DoSomething():
        break;
        case D:
        DoSomethingELse();
        break;
        case E:
        DoOtherThings();
        goto case D;
        default:
        DoDefault();
        break;
        }

        The first case A,B and C is OR, Case E is and and between E and D. http://msdn.microsoft.com/en-us/library/06tc147t(VS.71).aspx[^]

        Yusuf May I help you?

        A Offline
        A Offline
        ais07
        wrote on last edited by
        #3

        Thanks For Reply.It Works

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups