Correct implementation of a custom config section with nested collections?

I finally found this guy’s example. It was coded and worked right out of the box. http://manyrootsofallevilrants.blogspot.com/2011/07/nested-custom-configuration-collections.html I am going to paste the code here……only because I cannot stand it when someone says “Your answer is here”, and the link is dead. Please try his website first, and leave a “thank you” if it works. … Read more

Can’t load a manifest resource with GetManifestResourceStream()

The name of the resource is always: <Base namespace>.<RelativePathInProject>.<FileName> So if your resource is located in “Resources/Xsd/”, and your default project namespace is “MonitoringAPI.Configuration”, the resource name is: “MonitoringAPI.Configuration.Resources.Xsd.MonitoringConfiguration.xsd” Also make sure the build action for your resource is set to “Embedded Resource”

How do you use sections in c# 4.0 app.config?

<configSections> <section name=”FBI” type=”System.Configuration.NameValueSectionHandler” /> <section name=”FSCS” type=”System.Configuration.NameValueSectionHandler” /> </configSections> <FSCS> <add key=”processingDirectory” value=”C:\testfiles\ProccesFolder”/> </FSCS> <FBI> <add key=”processingDirectory” value=”C:\testfiles\ProccesFolder”/> </FBI> And then: var section = ConfigurationManager.GetSection(“FSCS”) as NameValueCollection; var value = section[“processingDirectory”];

How to get the values of a ConfigurationSection of type NameValueSectionHandler

Suffered from exact issue. Problem was because of NameValueSectionHandler in .config file. You should use AppSettingsSection instead: <configuration> <configSections> <section name=”DEV” type=”System.Configuration.AppSettingsSection” /> <section name=”TEST” type=”System.Configuration.AppSettingsSection” /> </configSections> <TEST> <add key=”key” value=”value1″ /> </TEST> <DEV> <add key=”key” value=”value2″ /> </DEV> </configuration> then in C# code: AppSettingsSection section = (AppSettingsSection)ConfigurationManager.GetSection(“TEST”); btw NameValueSectionHandler is not supported any … Read more