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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:49:07+00:00 2026-06-15T20:49:07+00:00

I have a MVVM Xaml application and I am trying to squeeze every last

  • 0

I have a MVVM Xaml application and I am trying to squeeze every last millisecond out of the startup out of this that I can. One thing that I noticed is that there is a conversion from codes to strings that is being pulled from the App.Config. There are only 5 values, so not a lot. I thought, I could put this in a switch statement and it would be faster (To my surprise it was the same time). This is called multiple times, around 80 and can be any one of the 5 values or none of the 5. Previously there was just a string.IsNullOrEmpty check on the value from ConfigurationManager.AppSettings to see if it found a value. In my switch I just put a default return “”. These values will rarely change, if ever, but could potentially have more.

So my question, is there a performance benefit to using switch or App.Config as the number of items changes? The only reason I put anything in App.Config is if the user needed to modify something without rebuilding the application. Currently since my testing shows the time to be the same I would tend to keep this in the App.Config, but I would just like to hear everyone’s thought on it.

Thanks,
TJ

  • 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-15T20:49:09+00:00Added an answer on June 15, 2026 at 8:49 pm

    Your parameters in the App config are cached after the first time they are read. The initial read will probably require some overhead since it costs disk access.

    The switch will also be faster in this case, we’re talking nanoseconds.
    I’d imagine that once your config values are actually read in the first time, the performance of reading them from the cache is similar.

    Since it seems you have a reason for allowing them to be changed by the user, I’d leave them in the app.config.

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

Sidebar

Related Questions

I can't figure this one out. I have a WPF application using the MVVM
I have a WPF application that mostly follows MVVM, which I am trying to
I have an MVVM application. In one of the ViewModels is the 'FindFilesCommand' which
I have a MVVM application that contains multiple views with some complex IsReadOnly rules
I have a WPF application built with MVVM and am trying to display a
I'm using Silverlight 5 with mvvm pattern. In xaml page I have one hyperlinkbutton
I am using the Business Silverlight application. I have incorporated some MVVM into this
I have been trying to wrap my head around mvvm for the last week
Hi I am trying to use Unity container in WPF MVVM application. I have
I have a C# WPF application using XAML and MVVM. My question is: How

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.