What is the purpose of the <Clear \>
XML element within the <AppSettings>
tag in an application's config file?
I see it removes previously added settings (see code below), but why would you want to do that?
<appSettings>
<add key="LogInformation" value="False"/>
<add key="LogAPIMessages" value="False"/>
<add key="LogErrors" value="True"/>
<clear/> <!--This line removes previously added keys.-->
</appSettings>
I also understand that when manipulating app settings in code you could clear existing keys, but why have the <clear\>
XML element?
Also, out of habit really, i've been putting the <clear\>
element before any <add>
elements. Do i need to do this, should i not be doing this?
This is applicable in scenarios when you have a web application within another web application. E.g you implement blog as a seperate application within your main application. Then in such cases "clear" is used to remove all references to inherited custom application settings, which are inherited from the parent application settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With