问题
This was from this question but I was told to ask a new one > [Equivalent to 'app.config' for a library (DLL)
Basically I am converting a console app to a DLL and I want to use config settings. They are saying to use an XML file (although I cannot get it to work - all strings come back as blank) but despite that I want to know how to replicate things like Mail Settings.
So how would I go about replicating thing like mail settings e.g
<system.net>
<mailSettings>
<smtp>
<network host="generic.smtp.local"/>
</smtp>
</mailSettings>
</system.net>
In an XML file that is just values not actually config for anything. Do I just need to pass these mail settings in manually to each call of a SendEmail method or can they be reproduced in a similar way as it would be good to keep all settings in one config file.
Thanks
来源:https://stackoverflow.com/questions/25138788/how-do-i-use-the-dll-app-config-hack-for-mail-host-settings