Skip to content

leojh/StronglyTypedAppSettings

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

StronglyTypedAppSettings

Use Dependency Injection to enable Strongly Typed Application Settings

CODE:

System.Console.WriteLine("The bad"); System.Console.WriteLine(ConfigurationManager.AppSettings["ConfigSettings.SampleSetting1"]); System.Console.WriteLine(ConfigurationManager.AppSettings["ConfigSettings.SampleSetting2"]);

System.Console.WriteLine(); System.Console.WriteLine();

System.Console.WriteLine("The better"); var settings = new SettingsInstanceFactory().GetInstanceOfConfigSettings(); System.Console.WriteLine(settings.SampleSetting1); System.Console.WriteLine(settings.SampleSetting2);

OUTPUT:

The bad My value for ConfigSettings.SampleSetting1 My value for ConfigSettings.SampleSetting2

The better My value for ConfigSettings.SampleSetting1 My value for ConfigSettings.SampleSetting2 Press any key to continue . . .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages