ElementInformation.IsPresent プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
関連付けられている ConfigurationElement オブジェクトが構成ファイル内に存在するかどうかを示す値を取得します。
public:
property bool IsPresent { bool get(); };
public bool IsPresent { get; }
member this.IsPresent : bool
Public ReadOnly Property IsPresent As Boolean
プロパティ値
関連付けられている ConfigurationElement オブジェクトが構成ファイル内に存在する場合は true
。それ以外の場合は false
。
例
IsPresent プロパティを使用する方法を次の例に示します。
static public void IsElementPresent()
{
// Get the current configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
// Get the section.
UrlsSection section =
(UrlsSection)config.GetSection("MyUrls");
// Get the element.
UrlConfigElement url = section.Simple;
bool isPresent =
url.ElementInformation.IsPresent;
Console.WriteLine("Url element is present? {0}",
isPresent.ToString());
}
Public Shared Sub IsElementPresent()
' 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)
' Get the element.
Dim url As UrlConfigElement = _
section.Simple
Dim isPresent As Boolean = _
url.ElementInformation.IsPresent
Console.WriteLine("Url element is present? {0}", _
isPresent.ToString())
End Sub