Friday, July 10, 2015

How to use ConfigurationManager to load config from an arbitrary location

The code goes as follows .

//Path to your config file

System.Configuration.ConfigurationFileMap 
fileMap = new 
ConfigurationFileMap(strConfigPath); 




System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(fileMap);


This  is the better solution which unit tests against a configuration file and want to parse a specific file . So try this out

No comments:

Post a Comment