SectionInformation.IsProtected プロパティ

定義

関連付けられている構成セクションが保護されているかどうかを示す値を取得します。

public:
 property bool IsProtected { bool get(); };
public bool IsProtected { get; }
member this.IsProtected : bool
Public ReadOnly Property IsProtected As Boolean

プロパティ値

この ConfigurationSection が保護されている場合は true。それ以外の場合は false。 既定値は、false です。

このセクションの例では、構成ファイル内の IsProtected 関連セクション情報にアクセスした後にプロパティ値を取得する方法を示します。

次の例では、 オブジェクトを 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

次の例では、 値を取得します IsProtected

bool protect =
    sInfo.IsProtected;
Console.WriteLine("Section protected?: {0}",
    protect.ToString());
Dim protect As Boolean = _
sInfo.IsProtected
Console.WriteLine("Section protected?: {0}", _
protect.ToString())

注釈

保護された構成セクションは暗号化され、読み取り専用です。

保護された構成セクションの詳細については、「保護された構成 を使用した構成情報の暗号化」を参照してください。

適用対象

こちらもご覧ください