ElementInformation クラス

定義

構成内の個々の要素に関するメタ情報が含まれています。 このクラスは継承できません。

public ref class ElementInformation sealed
public sealed class ElementInformation
type ElementInformation = class
Public NotInheritable Class ElementInformation
継承
ElementInformation

次の例は、 オブジェクトに関連付けられた を ElementInformation 取得する方法を ConfigurationElement 示しています。

static public ElementInformation
    GetElementInformation()
{

    // 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;

    ElementInformation eInfo =
        url.ElementInformation;

    return eInfo;
}
Public Shared Function GetElementInformation() _
As ElementInformation

    ' 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 eInfo As ElementInformation = _
    url.ElementInformation

    Return eInfo

End Function 'GetElementInformation

次の抜粋は、前のコード例で使用した構成を示しています。

<?xml version="1.0" encoding="utf-8"?>  
<configuration>  
  <configSections>  
    <section name="MyUrls" type="Samples.AspNet.UrlsSection,  
      ConfigurationElement, Version=1.0.0.0, Culture=neutral,  
      PublicKeyToken=null" allowDefinition="Everywhere"  
      allowExeDefinition="MachineToApplication"  
      restartOnExternalChanges="true" />  
  </configSections>  
  <MyUrls name="MyFavorites">  
    <simple name="Contoso" url="http://www.contoso.com" port="8080" />  
    <urls>  
      <clear />  
      <add name="Microsoft" url="http://www.microsoft.com" port="0" />  
    </urls>  
  </MyUrls>  
</configuration>  

注釈

オブジェクトには ElementInformation 、構成内の個々の要素に関するメタ情報が含まれています。 このオブジェクトは、個々の要素のプロパティを検証および変更するときに使用できます。

プロパティ

Errors

関連付けられている要素およびサブ要素のエラーを取得します。

IsCollection

関連付けられている ConfigurationElement オブジェクトが ConfigurationElementCollection コレクションであるかどうかを示す値を取得します。

IsLocked

関連付けられている ConfigurationElement オブジェクトが変更できないかどうかを示す値を取得します。

IsPresent

関連付けられている ConfigurationElement オブジェクトが構成ファイル内に存在するかどうかを示す値を取得します。

LineNumber

構成ファイル内の、関連付けられている ConfigurationElement オブジェクトが定義されている位置の行番号を取得します。

Properties

関連付けられている PropertyInformationCollection オブジェクトのプロパティの ConfigurationElement コレクションを取得します。

Source

関連付けられている ConfigurationElement オブジェクトの生成元であるソース ファイルを取得します。

Type

関連付けられている ConfigurationElement オブジェクトの型を取得します。

Validator

関連付けられている ConfigurationElement オブジェクトの検証に使用されるオブジェクトを取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください