ProvidePropertyAttribute クラス
アセンブリ: System (system.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple:=True)> _ Public NotInheritable Class ProvidePropertyAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true)] public sealed class ProvidePropertyAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple=true)] public ref class ProvidePropertyAttribute sealed : public Attribute

この属性でクラスをマークする場合は、指定した名前でエクステンダ プロパティを作成するようにコード ジェネレータに指示します。マークされたクラスは、IExtenderProvider を実装する必要があります。その結果、新しいプロパティをコンテナ内の他のコンポーネントで使用できるようになります。
マークされたクラスの内部で、Get <name> メソッドと Set <name> メソッドを実装する必要があります。たとえば、[ProvideProperty("PropertyName")] でクラスをマークした場合は、GetPropertyName メソッドと SetPropertyName メソッドを実装する必要があります。新しいプロパティをエクステンダ プロパティとして指定するには、IExtenderProvider から実装し、CanExtend メソッドも実装する必要があります。

MyClass を ProvidePropertyAttribute でマークし、GetMyProperty メソッドと SetMyProperty メソッドから MyProperty という名前のプロパティを作成するようにコンパイラに指示する例を次に示します。
<ProvideProperty("MyProperty", GetType(Control))> _ Public Class SampleClass Implements IExtenderProvider Protected ciMine As CultureInfo = Nothing ' Provides the Get portion of MyProperty. Public Function GetMyProperty(myControl As Control) As CultureInfo ' Insert code here. Return ciMine End Function 'GetMyProperty ' Provides the Set portion of MyProperty. Public Sub SetMyProperty(myControl As Control, value As String) ' Insert code here. End Sub 'SetMyProperty ' When you inherit from IExtenderProvider, you must implement the ' CanExtend method. Public Function CanExtend(target As [Object]) As Boolean Implements IExtenderProvider.CanExtend Return TypeOf target Is Control End Function 'CanExtend ' Insert additional code here. End Class
[ProvideProperty("MyProperty", typeof(Control))] public class MyClass : IExtenderProvider { protected CultureInfo ciMine = null; // Provides the Get portion of MyProperty. public CultureInfo GetMyProperty(Control myControl) { // Insert code here. return ciMine; } // Provides the Set portion of MyProperty. public void SetMyProperty(Control myControl, string value) { // Insert code here. } /* When you inherit from IExtenderProvider, you must implement the * CanExtend method. */ public bool CanExtend(Object target) { return(target is Control); } // Insert additional code here. }
[ProvideProperty("MyProperty",Control::typeid)] public ref class MyClass: public IExtenderProvider { protected: CultureInfo^ ciMine; public: // Provides the Get portion of MyProperty. CultureInfo^ GetMyProperty( Control^ myControl ) { // Insert code here. return ciMine; } // Provides the Set portion of MyProperty. void SetMyProperty( Control^ myControl, String^ value ) { // Insert code here. } /* When you inherit from IExtenderProvider, you must implement the * CanExtend method. */ virtual bool CanExtend( Object^ target ) { return dynamic_cast<Control^>(target) != nullptr; } // Insert additional code here. };
public class MyClass implements IExtenderProvider { protected CultureInfo ciMine = null; // Provides the Get portion of MyProperty. public CultureInfo GetMyProperty(Control myControl) { // Insert code here. return ciMine; } //GetMyProperty // Provides the Set portion of MyProperty. public void SetMyProperty(Control myControl, String value) { // Insert code here. } //SetMyProperty /* When you inherit from IExtenderProvider, you must implement the * CanExtend method. */ public boolean CanExtend(Object target) { return target instanceof Control; } //CanExtend // Insert additional code here. } //MyClass

System.Attribute
System.ComponentModel.ProvidePropertyAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProvidePropertyAttribute コンストラクタ (String, String)
アセンブリ: System (system.dll 内)

Dim propertyName As String Dim receiverTypeName As String Dim instance As New ProvidePropertyAttribute(propertyName, receiverTypeName)

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProvidePropertyAttribute コンストラクタ (String, Type)
アセンブリ: System (system.dll 内)

Dim propertyName As String Dim receiverType As Type Dim instance As New ProvidePropertyAttribute(propertyName, receiverType)

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProvidePropertyAttribute コンストラクタ

名前 | 説明 |
---|---|
ProvidePropertyAttribute (String, String) | プロパティの名前とそのプロパティを受け取る側の型を指定して、ProvidePropertyAttribute クラスの新しいインスタンスを初期化します。 |
ProvidePropertyAttribute (String, Type) | プロパティの名前とその Type を指定して、ProvidePropertyAttribute クラスの新しいインスタンスを初期化します。 |

ProvidePropertyAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | PropertyName | クラスが提供するプロパティの名前を取得します。 |
![]() | ReceiverTypeName | このプロパティが拡張できるデータ型の名前を取得します。 |
![]() | TypeId | オーバーライドされます。 この属性の一意の識別子を取得します。 |

ProvidePropertyAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の ProvidePropertyAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

ProvidePropertyAttribute メンバ
IExtenderProvider の実装元が他のコンポーネントに提供するプロパティの名前を指定します。このクラスは継承できません。
ProvidePropertyAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | PropertyName | クラスが提供するプロパティの名前を取得します。 |
![]() | ReceiverTypeName | このプロパティが拡張できるデータ型の名前を取得します。 |
![]() | TypeId | オーバーライドされます。 この属性の一意の識別子を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 指定したオブジェクトの値が現在の ProvidePropertyAttribute と等しいかどうかを示す値を返します。 |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | オーバーライドされます。 対象のインスタンスのハッシュ コードを返します。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- ProvidePropertyAttributeのページへのリンク