C#: Changing ‘Magic Number’ Variable to a Config Setting

Andrew Park
1 min readJun 24, 2018

--

The Challenge: A client has requested to extend its 15-day grace period for dues payments to 30 days.

The Solution:

  1. Find the code setting the grace period. Navigate to VSTS repo and search for “15”, leading to the line(s) of code controlling the grace period variable.
  2. Load the solution locally through TFS. Open VS17 > Team Explorer > Manage Connections > Connect to client folder and load appropriate solution file. Ensure root path is C:\Code (Source Control Explorer).
  3. Flip to Solution Explorer and locate the file containing the line of code identified from Step 1.
  4. Unload the parent directory. Check References to make sure each dependency is properly called. (Look up Properties, F4, for any that are unresolved and relay to correct paths.)
  5. Refactor the “magic number” variable into an app setting and Build. (Switched Debug to Release.)
  1. Reload the parent directory and commit change to TFS.
  2. Connect to remote server following internal documentation.
  3. Add this new app setting to web config file on iMIS server. Now the “magic number” is a configurable variable that can be easily changed.

--

--

Andrew Park
Andrew Park

Written by Andrew Park

Into: Software, E-Commerce, Digital Marketing. Former & future journalist. Kid from Queens.

No responses yet