Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8687211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:03:53+00:00 2026-06-12T23:03:53+00:00

When working with switch case , for example I could use const string FirstFloor

  • 0

When working with switch case, for example
I could use

const string FirstFloor = "lvl1", SecondFloor = "lvl2", ThirdFloor = "lvl3"; 

string ElavaetTo= "lvl1";

switch(ElavaetTo)
{
  case FirstFloor:
  Response.Redirect(FirstFloor + "Page.aspx")
  break;

  case SecondFloor:
  Response.Redirect(SecondFloor + "Page.aspx")
  break;

  case ThirdFloor:
  Response.Redirect(ThirdFloor + "Page.aspx")
  break;       
}
  • Edited :

this is only an example of where constant string wil not work if placed in another class
this is not a function / method i am trying to correct so it will work.
thanks for your time, i am trying to base my methods , my approach…

This would work fine placed in the current or same class of the project but when all variables are stored outside this class instead of simply instantiating the class and methods only once :

fullClassName shrtNm = New fullClassName();

then you would like to call it as with

shrtNm.MethodName();

You need to go the ‘Long way around’ specially if not including the Namespace via using statement

and you would have to call it like:

string strnm = MyNameOfNameSpace.fullClassName.ConstantntStrName;

instead of:

string strnm = shrtNm.ConstantStrName;

Is there an alternative to using any type that will represent string values inside the IntelliSense in an easy way ?

I have tried to use

public enum Elavation
{
    lvl1,
    lvl2,
    lvl3
}

but then you need to declare it as in the long example plus a .ToString()

Is there any alternative at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:03:54+00:00Added an answer on June 12, 2026 at 11:03 pm

    as far as i could get (only because it was important for me to addapt an aproach )
    i found an example in a codeProjec page about using strings and String-Enumerations

    that lead me to use that aproach and then turn my calss into a static class

     public static class Qs
        {
            public sealed class Act
            {
                //private Act();
                public const string edit = "edit", add = "add", remove = "remove", replace = "replace";
    
            }
           public sealed class State
            {
               public const string addnewTableRow = "addnewTableRow", cancelInsert = "cancelInsert", loadpagefromlink="loadpagefromlink";
            }
           public sealed class Params
            {
                 public const string state = "state";
                 public const string custID = "custID";
                 public const string recordID = "recordID";
            }
    

    }

    using sealed class accessing it via its parent className.Itsname
    e.g.

    Qs.Act.edit
    

    as edit would show in IntelliSense

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project where I need to switch for example between
In case of comma separation not working with swtich case. is there any way
Alright have been working to switch to jQuery 1.7's new and improved .on() function
We are working with a PHP application which has no concept of switch-able themes;
I've come across a switch statement in the codebase I'm working on and I'm
I'm working on a WordPress that will allow the site administrator to switch between
I'm working on a cocoa-touch app using OpenAL, but I'm willing to switch to
Currently I am working on a application, which contains one switch. When we touch
Currently I am working on selenium IDE, now I need to switch to selenium
This was working correctly in Visual Studio 2008, but since I have switch to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.