更新 : 2007 年 11 月
指定した型のメタデータがこのテーブルに格納されているかどうかを示す値を返します。
名前空間 : Microsoft.Windows.Design.Metadata
アセンブリ : Microsoft.Windows.Design (Microsoft.Windows.Design.dll 内)
構文
'宣言
Public Function ContainsAttributes ( _
type As Type _
) As Boolean
'使用
Dim instance As AttributeTable
Dim type As Type
Dim returnValue As Boolean
returnValue = instance.ContainsAttributes(type)
public bool ContainsAttributes(
Type type
)
public:
bool ContainsAttributes(
Type^ type
)
public function ContainsAttributes(
type : Type
) : boolean
パラメータ
type
型 : System.Typeメタデータ属性をチェックする型。
戻り値
型 : System.Boolean
指定した型の属性がテーブルに含まれている場合は true。それ以外の場合は false。
例外
例外 | 条件 |
---|---|
ArgumentNullException | type が nullnull 参照 (Visual Basic では Nothing) です。 |
解説
メタデータは、クラス レベルのメタデータの場合もあれば、DependencyProperty または MemberDescriptor に関連付けられているメタデータの場合もあります。MetadataStore は、新しい属性テーブルが追加されたときに Refreshed イベントの発生を必要とする型を識別したり、属性のクエリ中にさらに詳しく照会する必要のあるテーブルをすばやく決定したりするために、このメソッドを使用します。
例
ContainsAttributes メソッドを使用して、型にカスタム属性が含まれているかどうかを判断する方法を次のコード例に示します。このコード例は、AttributeTable クラスのトピックで取り上げているコード例の一部分です。
Dim hasCustomAttributes As Boolean = attributes.ContainsAttributes(GetType(Button))
bool hasCustomAttributes = attributes.ContainsAttributes(typeof(Button));
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
Microsoft.Windows.Design.Metadata 名前空間