- You implement a Library called
LogLibrarywhich needs configuration values, - To retrieve the configuration values you implement your own
System.Configuration.IConfigurationSectionHandler, - So in the
App.configfile of the Program usingLogLibrary, you want to find something like:
<configuration>
<configSections>
<section name="LogLibrary" type="Class, Namespace"/>
</configSections>
<LogLibrary>
<!-- Directory where daily log files will be created. -->
<LogDirectory>C:\Logs</LogDirectory>
<!-- Insert other values here -->
</LogLibrary>
</configuration>
Question: What is the best way to indicate to the users of the LogLibrary what needs to be present in App.config ?
I personally provide a README.txt file (included in the Library’s VS project) with the Library. But i find this solution to be “amateur”. Do you guys have better practices ?
You would not need a readme.txt, just include an app.config in your library with sample values as you have shown above and mention this in the documentation. Developers will notice this either in your source file or in the documentation you provide online or offline and will copy that section (same as above) in their app.config or web.config.
This is how it normally goes for Log4Net, that you google and find examples on their websites.