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 8980003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:58:31+00:00 2026-06-15T19:58:31+00:00

string liquidClass = string.Empty; switch (cmbLiquidClass.Text) { case LiquidClass1: liquidClass = Settings.Default.LiquidClass1; break; case

  • 0
string liquidClass = string.Empty;

switch (cmbLiquidClass.Text)
{
    case "LiquidClass1":
        liquidClass = Settings.Default.LiquidClass1;
        break;
    case "LiquidClass2":
        liquidClass = Settings.Default.LiquidClass2;
        break;
    case "LiquidClass3":
        liquidClass = Settings.Default.LiquidClass3;
        break;
    case "LiquidClass4":
        liquidClass = Settings.Default.LiquidClass4;
        break;
    case "LiquidClass5":
        liquidClass = Settings.Default.LiquidClass5;
        break;
    case "LiquidClass6":
        liquidClass = Settings.Default.LiquidClass6;
        break;
    case "LiquidClass7":
        liquidClass = Settings.Default.LiquidClass7;
        break;
    case "LiquidClass8":
        liquidClass = Settings.Default.LiquidClass8;
        break;
    case "LiquidClass9":
        liquidClass = Settings.Default.LiquidClass9;
        break;
}

Trying to get in to a local variable the contents of the current class. I can’t use a dictionary because of the way strings work (behaving like value types). Is there any way to refactor this so that it doesn’t require this many lines to find the chosen liquid class?

  • 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-15T19:58:32+00:00Added an answer on June 15, 2026 at 7:58 pm

    You can use the indexer that is part of Settings.Default (tested with .Net 4.0):

    var liquidClass = Settings.Default[cmbLiquidClass.Text].ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

string rawConnString = Properties.Settings.Default.ConnectionString; I want to do this with rawConnString: rawConnString.Replace(<<DATA_SOURCE>>, server); rawConnString.Replace(<<INITIAL_CATALOG>>,
string one = find; combobox1.text = one; I want to use one i.e string
string.lastIndexOf(searchValue[, fromIndex]) MDN says that fromIndex default value is equal to the string.length ,
String linkPattern = \\[[A-Za-z_0-9]+\\]; String text = [build]/directory/[something]/[build]/; RegExp reg = RegExp.compile(linkPattern,g); MatchResult matchResult
string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my
string [] files = new string[2]; files[0] = ThinkFarAhead.Example.Settings.Configuration_Local.xml; files[1] = ThinkFarAhead.Example.Settings.Configuration_Global.xml; //Resharper complains
string s = <script type=text/javascript src=/stepcarousel.js></script> How can I get the data inside the
String inputPass = textBox2.Text; byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(inputPass); byte[] inputHashedBytes = Sha256.ComputeHash(inputBytes); String inputHash
string[] lines = { textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text }; Random RandString =
string ouString = projectBox.Text.ToString(); string parentName = LDAP://OU=+ouString+,OU=Clients,OU=Clients,DC=domain,DC=net; DirectoryEntry parentEntry = new DirectoryEntry(parentName); DirectoryEntry

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.