ConfigurationManager.OpenMappedExeConfiguration メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConfigurationManager.OpenMappedExeConfiguration メソッドの意味・解説 

ConfigurationManager.OpenMappedExeConfiguration メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

指定したファイル マップユーザー レベル使用して指定したクライアント構成ファイルConfiguration オブジェクトとして開きます

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

Public Shared Function OpenMappedExeConfiguration
 ( _
    fileMap As ExeConfigurationFileMap, _
    userLevel As ConfigurationUserLevel _
) As Configuration
Dim fileMap As ExeConfigurationFileMap
Dim userLevel As ConfigurationUserLevel
Dim returnValue As Configuration

returnValue = ConfigurationManager.OpenMappedExeConfiguration(fileMap, userLevel)
public static Configuration OpenMappedExeConfiguration
 (
    ExeConfigurationFileMap fileMap,
    ConfigurationUserLevel userLevel
)
public:
static Configuration^ OpenMappedExeConfiguration (
    ExeConfigurationFileMap^ fileMap, 
    ConfigurationUserLevel userLevel
)
public static Configuration OpenMappedExeConfiguration
 (
    ExeConfigurationFileMap fileMap, 
    ConfigurationUserLevel userLevel
)
public static function OpenMappedExeConfiguration
 (
    fileMap : ExeConfigurationFileMap, 
    userLevel : ConfigurationUserLevel
) : Configuration

パラメータ

fileMap

アプリケーション既定構成ファイル代わりに使用する構成ファイル参照する ExeConfigurationFileMap オブジェクト

userLevel

構成を開く対象となる ConfigurationUserLevel オブジェクト

戻り値
Configuration オブジェクト

例外例外
例外種類条件

ConfigurationErrorsException

構成ファイル読み込むことができませんでした

解説解説
使用例使用例

OpenMappedExeConfiguration メソッド使用して構成ファイル含まれるすべてのセクション取得する方法次のコード例示します

' Get all the sections in the mapped exe.config.
' Show how to use the 
' GetMappedExeConfigurationSections(fileMap, userLevel) method.
Shared Sub GetMappedExeConfigurationSections()
   ' Get the machine.config file.
   Dim fileMap As New ExeConfigurationFileMap()
   ' You may want to map to your own exe.comfig file here.
     fileMap.ExeConfigFilename = _
     "C:\test\ConfigurationManager.exe.config"
     Dim config As System.Configuration.Configuration
 = _
     ConfigurationManager.OpenMappedExeConfiguration(fileMap, _
     ConfigurationUserLevel.None)
   
   ' Loop to get the sections. Display basic information.
   Console.WriteLine("Name, Allow Definition")
   Dim i As Integer = 0
   Dim section As ConfigurationSection
   For Each section In 
 config.Sections
         Console.WriteLine(( _
         section.SectionInformation.Name + _
         ControlChars.Tab + _
         section.SectionInformation.AllowExeDefinition.ToString()))
      i += 1
   Next section 
   Console.WriteLine("[Total number of sections: {0}]",
 i)
   
   ' Display machine.config path.
   Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub 'GetMappedExeConfigurationSections
 
// Get all the sections in the mapped exe.config.
// Show how to use the 
// GetMappedExeConfigurationSections(fileMap, userLevel) method.
static void GetMappedExeConfigurationSections()
{
    // Get the machine.config file.
    ExeConfigurationFileMap fileMap =
        new ExeConfigurationFileMap();
    // You may want to map to your own exe.comfig file here.
    fileMap.ExeConfigFilename = 
        @"C:\test\ConfigurationManager.exe.config";
    System.Configuration.Configuration config =
        ConfigurationManager.OpenMappedExeConfiguration(fileMap, 
        ConfigurationUserLevel.None);

    // Loop to get the sections. Display basic information.
    Console.WriteLine("Name, Allow Definition");
    int i = 0;
    foreach (ConfigurationSection section in
 config.Sections)
    {
        Console.WriteLine(
            section.SectionInformation.Name + "\t" +
        section.SectionInformation.AllowExeDefinition);
        i += 1;

    }
    Console.WriteLine("[Total number of sections: {0}]", i);

    // Display machine.config path.
    Console.WriteLine("[File path: {0}]", config.FilePath);

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からConfigurationManager.OpenMappedExeConfiguration メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からConfigurationManager.OpenMappedExeConfiguration メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からConfigurationManager.OpenMappedExeConfiguration メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ConfigurationManager.OpenMappedExeConfiguration メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConfigurationManager.OpenMappedExeConfiguration メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS