ConfigurationManager.OpenMappedExeConfiguration メソッド
アセンブリ: 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
戻り値
Configuration オブジェクト。


ConfigurationUserLevel オブジェクトは、構成ファイルがユーザー レベルではない (構成ファイルがアプリケーションと同じディレクトリにある)、またはユーザー単位のレベル (構成ファイルが userLevel で決まるアプリケーション設定のパスにある) のどちらであるかを示すことによって、開く構成ファイルの場所を決定します。
![]() |
---|
リソースの Configuration オブジェクトを取得するには、設定の継承元となるすべての構成ファイルに対する読み取り特権がコードに付与されている必要があります。構成ファイルを更新するには、構成ファイルとそれを格納するディレクトリの両方に対する書き込み特権も、コードに付与されている必要があります。 |

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); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ConfigurationManager クラス
ConfigurationManager メンバ
System.Configuration 名前空間
ConfigurationUserLevel
Configuration クラス
Weblioに収録されているすべての辞書からConfigurationManager.OpenMappedExeConfiguration メソッドを検索する場合は、下記のリンクをクリックしてください。

- ConfigurationManager.OpenMappedExeConfiguration メソッドのページへのリンク