App.configからの読込(独自Section)

■事前準備

 ・プロジェクト→プロパティ→参照設定から、以下を追加

  -System.Configuration

■独自セクション定義

 ・<configSections>の直下に<section name>を追加
  <configSections>
    <section name="FilePaths" type="System.Configuration.NameValueFileSectionHandler" restartOnExternalChanges="false" />
  </configSections>

 ・section nameに指定した名称で、タグを切る

  <FilePaths>
   <add key="ErrorLog" value="C:\TestApplicationLog\Error.log" />
   <add key="ApplicationLog" value="C:\TestApplicationLog\Operation.log" />
  </FilePaths>

■読込たい場所でSectionを定義

  Dim fileSection = ConfigurationManager.GetSection(FilePaths)
  logFileName = fileSection(ErrorLog)