SectionInformation.AllowLocation プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
構成セクションで location 属性を許可するかどうかを示す値を取得または設定します。
public:
property bool AllowLocation { bool get(); void set(bool value); };
public bool AllowLocation { get; set; }
member this.AllowLocation : bool with get, set
Public Property AllowLocation As Boolean
プロパティ値
true です。
例外
選択した値が、既に定義されている値と競合しています。
例
このセクションの例では、構成ファイル内の関連セクション情報にアクセスした後、 AllowLocation プロパティ値を取得する方法を示します。
次の例では、 SectionInformation オブジェクトを取得します。
// Get the current configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
// Get the section.
UrlsSection section =
(UrlsSection)config.GetSection("MyUrls");
SectionInformation sInfo =
section.SectionInformation;
' Get the current configuration file.
Dim config _
As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)
' Get the section.
Dim section As UrlsSection = _
CType(config.GetSection("MyUrls"), UrlsSection)
Dim sInfo As SectionInformation = _
section.SectionInformation
次の例では、 AllowLocation 値を取得します。
bool allowLocation =
sInfo.AllowLocation;
Console.WriteLine("Allow location: {0}",
allowLocation.ToString());
Dim allowLocation As Boolean = _
sInfo.AllowLocation
Console.WriteLine("Allow location: {0}", _
allowLocation.ToString())
注釈
falseに設定すると、AllowLocation プロパティは、セクションがネイティブ コード リーダーによってアクセスされることを示します。 そのため、ネイティブ コード リーダーはlocationの概念をサポートしていないため、location属性の使用は許可されません。