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

  • Home
  • SEARCH
  • 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 6205745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:19:41+00:00 2026-05-24T05:19:41+00:00

I’m working on a code base that has a lot of identical ConfigurationManager.AppSetting calls

  • 0

I’m working on a code base that has a lot of identical ConfigurationManager.AppSetting calls scattered throughout.

Does this sound like a possible performance issue?

Or because the data being very small is trivial and not ‘expensive’? Constantly going back to the file to get the data, or does the .NET runtime cache the file/values/calls?

If this isn’t a performance issue is it just a disorganized approach to accessing the application configuration values, and should just be re-factored to be cleaner and consistent implementation of accessing the settings?

  • 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-05-24T05:19:42+00:00Added an answer on May 24, 2026 at 5:19 am

    I would say it’s more of the code maintainability issue than performance issue. A simple dictionary lookup on AppSettings isn’t going to be a problem unless you have code that tries to perform lookup on AppSettings in a loop that runs say hundred times. Surely such a code will cause performance problem. But even more important is you will have ConfigurationManager.AppSettings["MyKey"] throughout your codebase. You are introducing a magic string. If you have to change the key in your configuration file, you will have to do a thorough search and replace in all your projects. Moreover, we usually make some decision based on the value stored in appSettings. It’s not always straighforward read and use the value as-is. Sometimes you take decision based on the value. For ex,

    if (ConfigurationManager.AppSettings["DebugMode"] == "yes")
      do this
    else
      do that
    

    You might be repeating this logic in hundred places. Now let’s say you need to add another condition there:

    if (ConfigurationManager.AppSettings["DebugMode"] == "yes" || ConfigurationManager.AppSettings["InternetNotAvailable"] == "yes")
      do this
    else
      do that
    

    This gets messy. Your code starts to stink.

    So, I always recommend my dev team to never use ConfigurationManager.AppSettings anywhere in the code. Use some static class where you read the configuration values and all such decisions are precached into a single variable. For ex,

    static class ConfigHelper
    {
      private readonly static bool ExternalWebserviceCallAllowed = ConfiguationManager.AppSettings["DevMode"] == "false" && ConfigurationManager.AppSettings["InternetAvailable"] == "true";
    
    }
    
    .
    .
    if (ConfigHelper.ExternalWebserviceCallAllowed)
       do this
    else
       do that
    

    This is not only better in performance, but also highly maintainable and extensible code.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have this code to decode numeric html entities to the UTF8 equivalent character.
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT

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.