views:

590

answers:

1

I am using something like the following to load DLL's in my C# app.

foreach (String s in Directory.GetFiles(".", "*.dll"))
foreach (Type t in Assembly.LoadFrom(s).GetTypes())

But it does not apply the App.config settings for those binaries. Is there a programatic way to load these settings?

+3  A: 

Hi have a look at ConfigurationManager.OpenMappedExeConfiguration on MSDN. This allows you to read in config types (for users) at runtime.

Russell
I was able to simply run the following code in the constructor of the classes I am loading into memory ...onfigurationManager.OpenMappedExeConfiguration(null, ConfigurationUserLevel.None);Thanks mate.
Nippysaurus