stackoverflowさん、そのままです
app.configのconfigSectionsセクションに追加セクション(MajorCommands)を記載
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="MajorCommands" type="System.Configuration.DictionarySectionHandler" /> </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <appSettings> 省略・・・ </appSettings> <MajorCommands> <add key="Standby" value="STBY"/> <add key="Operate" value="OPER"/> <add key="Remote" value="REMOTE"/> <add key="Local" value="LOCAL"/> <add key="Reset" value="*RST" /> </MajorCommands> </configuration>
C#ではConfigurationManagerのGetSectionでセクション以下をハッシュに読み込み
System.Collections.Hashtable nb = System.Configuration.ConfigurationManager.GetSection("MajorCommands") as System.Collections.Hashtable;