c# switch statement - variable "case"?

Posted by dotnet-practitioner on Stack Overflow See other posts from Stack Overflow or by dotnet-practitioner
Published on 2010-03-25T18:18:58Z Indexed on 2010/03/25 18:33 UTC
Read the original article Hit count: 409

Filed under:

For ScoreOption, I expect to get the following input "A", "B", and T_(state) for example T_NY

so..

how can I write case switch statement for third option T_(state)

        switch(ScoreOption.ToUpper().Trim())
        {
            case "A":

                ....

                break;
            case "B":

                ....

                break;
            case T_????
                ....
                break;

        }

I might as well write if-else statement??

© Stack Overflow or respective owner

Related posts about c#