ConfigurationManager.GetSection メソッド
アセンブリ: System.Configuration (system.configuration.dll 内)

Dim sectionName As String Dim returnValue As Object returnValue = ConfigurationManager.GetSection(sectionName)
戻り値
指定した ConfigurationSection オブジェクト。セクションが存在しない場合は null 参照 (Visual Basic では Nothing)。


クライアント アプリケーションの場合、このメソッドはアプリケーション構成ファイル、ローカル ユーザー構成ファイル、およびローミング構成ファイルをマージすることによって作成された構成ファイルを取得します。
GetSection メソッドは、このメソッドが変更できない実行時の構成情報にアクセスします。構成を変更するには、次の Open メソッドのいずれかを使用して取得した構成ファイルで GetSection メソッドを使用します。
-
OpenExeConfiguration
-
OpenMachineConfiguration
-
OpenMappedExeConfiguration
-
OpenMappedExeConfiguration

GetSection メソッドを使用して、構成のカスタム セクションを作成し、アプリケーション構成ファイルに保存する方法を次のコード例に示します。
' Get the a custom section. Show how to use the ' GetSection method. Shared Sub GetCustomSection() ' Get the custom section. Dim custSection As CustomSection = _ ConfigurationManager.GetSection("CustomSection") ' Read the custom section. Console.WriteLine( _ "File name: {0} MaxIdleTime: {1} MaxUsers: {2}", _ custSection.FileName, custSection.MaxIdleTime, _ custSection.MaxUsers) End Sub 'GetCustomSection
// Get the a custom section. Show how to use the // GetSection method. static void GetCustomSection() { // Get the custom section. CustomSection custSection = ConfigurationManager.GetSection("CustomSection") as CustomSection; // Read the custom section. Console.WriteLine("File name: {0} MaxIdleTime: {1} MaxUsers: {2}", custSection.FileName, custSection.MaxIdleTime, custSection.MaxUsers); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からConfigurationManager.GetSection メソッドを検索する場合は、下記のリンクをクリックしてください。

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