次の方法で共有


SectionInformation.AllowLocation プロパティ

定義

構成セクションで 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

プロパティ値

属性が許可されている場合は a0/&。それ以外の場合は。 既定値は、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属性の使用は許可されません。

適用対象