ConfigurationSection.GetRuntimeObject メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
派生クラスでオーバーライドされると、カスタム オブジェクトを返します。
protected public:
virtual System::Object ^ GetRuntimeObject();
protected internal virtual object GetRuntimeObject();
abstract member GetRuntimeObject : unit -> obj
override this.GetRuntimeObject : unit -> obj
Protected Friend Overridable Function GetRuntimeObject () As Object
返品
セクションを表すオブジェクト。
例
次の例は、 GetRuntimeObject メソッドの使用方法を示しています。
// Customizes the use of CustomSection
// by setting _ReadOnly to false.
// Remember you must use it along with ThrowIfReadOnly.
protected override object GetRuntimeObject()
{
// To enable property setting just assign true to
// the following flag.
_ReadOnly = true;
return base.GetRuntimeObject();
}
' Customizes the use of CustomSection
' by setting _ReadOnly to false.
' Remember you must use it along with ThrowIfReadOnly.
Protected Overrides Function GetRuntimeObject() As Object
' To enable property setting just assign true to
' the following flag.
_ReadOnly = True
Return MyBase.GetRuntimeObject()
End Function 'GetRuntimeObject
注釈
GetSection メソッドが実行時に呼び出されると、構成システムは最初に ConfigurationSection クラスの適切なインスタンスを作成し、GetRuntimeObject メソッドから取得したオブジェクトを返します。
既定では、 GetRuntimeObject は呼び出し元の ConfigurationSection を表すオブジェクトを単に返します。
注意 (継承者)
GetRuntimeObject() メソッドをオーバーライドして、実行時にカスタム型を返すことができます。
たとえば、 ConfigurationSection クラスの設定のランタイム変更を制限するには、 GetRuntimeObject() をオーバーライドし、変更できる設定 (ある場合) に制限を適用するカスタム型を返します。
ランタイム オブジェクトが内部オブジェクトのみである場合、返されるオブジェクトは、それを定義するアセンブリの外部では使用できません。 ConfigurationSectionから派生し、実行時にアセンブリ内のコードによってのみアクセスできるオブジェクトを作成する 1 つの方法は、ConfigurationSection実装を返すメソッドを持つ内部ランタイム オブジェクトを作成することです。