ProvidePropertyAttributeとは? わかりやすく解説

ProvidePropertyAttribute クラス

IExtenderProvider の実装元が他のコンポーネント提供するプロパティの名前を指定します。このクラス継承できません。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple:=True)> _
Public NotInheritable Class
 ProvidePropertyAttribute
    Inherits Attribute
Dim instance As ProvidePropertyAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true)]
 
public sealed class ProvidePropertyAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple=true)]
 
public ref class ProvidePropertyAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true)
 */ 
public final class ProvidePropertyAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true)
 
public final class ProvidePropertyAttribute
 extends Attribute
解説解説

この属性クラスマークする場合は、指定した名前でエクステンダ プロパティ作成するようにコード ジェネレータ指示しますマークされクラスは、IExtenderProvider実装する必要がありますその結果新しプロパティコンテナ内の他のコンポーネント使用できるようになります

マークされクラス内部で、Get <name> メソッドSet <name> メソッド実装する必要があります。たとえば、[ProvideProperty("PropertyName")] でクラスマークした場合は、GetPropertyName メソッドSetPropertyName メソッド実装する必要があります新しプロパティをエクステンダ プロパティとして指定するには、IExtenderProvider から実装し、CanExtend メソッド実装する必要があります

詳細については、属性概要属性使用したメタデータ拡張 の各トピック参照してください

使用例使用例

MyClassProvidePropertyAttributeマークし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.Object
   System.Attribute
    System.ComponentModel.ProvidePropertyAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ProvidePropertyAttribute コンストラクタ (String, String)

プロパティの名前とそのプロパティ受け取る側の型を指定して、ProvidePropertyAttribute クラス新しインスタンス初期化します。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    propertyName As String, _
    receiverTypeName As String _
)
Dim propertyName As String
Dim receiverTypeName As String

Dim instance As New ProvidePropertyAttribute(propertyName,
 receiverTypeName)
public ProvidePropertyAttribute (
    string propertyName,
    string receiverTypeName
)
public:
ProvidePropertyAttribute (
    String^ propertyName, 
    String^ receiverTypeName
)
public ProvidePropertyAttribute (
    String propertyName, 
    String receiverTypeName
)
public function ProvidePropertyAttribute (
    propertyName : String, 
    receiverTypeName : String
)

パラメータ

propertyName

指定した型のオブジェクト拡張するプロパティの名前。

receiverTypeName

このプロパティ拡張できるデータ型の名前。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ProvidePropertyAttribute クラス
ProvidePropertyAttribute メンバ
System.ComponentModel 名前空間

ProvidePropertyAttribute コンストラクタ (String, Type)

プロパティの名前とその Type指定して、ProvidePropertyAttribute クラス新しインスタンス初期化します。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    propertyName As String, _
    receiverType As Type _
)
Dim propertyName As String
Dim receiverType As Type

Dim instance As New ProvidePropertyAttribute(propertyName,
 receiverType)
public ProvidePropertyAttribute (
    string propertyName,
    Type receiverType
)
public:
ProvidePropertyAttribute (
    String^ propertyName, 
    Type^ receiverType
)
public ProvidePropertyAttribute (
    String propertyName, 
    Type receiverType
)
public function ProvidePropertyAttribute (
    propertyName : String, 
    receiverType : Type
)

パラメータ

propertyName

指定した型のオブジェクト拡張するプロパティの名前。

receiverType

プロパティ受け取ることができるオブジェクトデータ型Type

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ProvidePropertyAttribute クラス
ProvidePropertyAttribute メンバ
System.ComponentModel 名前空間

ProvidePropertyAttribute コンストラクタ

ProvidePropertyAttribute クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

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

関連項目

ProvidePropertyAttribute クラス
ProvidePropertyAttribute メンバ
System.ComponentModel 名前空間

ProvidePropertyAttribute プロパティ


ProvidePropertyAttribute メソッド


パブリック メソッドパブリック メソッド

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

関連項目

ProvidePropertyAttribute クラス
System.ComponentModel 名前空間

ProvidePropertyAttribute メンバ

IExtenderProvider の実装元が他のコンポーネント提供するプロパティの名前を指定します。このクラス継承できません。

ProvidePropertyAttribute データ型公開されるメンバを以下の表に示します


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

関連項目

ProvidePropertyAttribute クラス
System.ComponentModel 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ProvidePropertyAttribute」の関連用語

ProvidePropertyAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ProvidePropertyAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS