Share via


AttributeTable.ContainsAttributes Method

Returns a value indicating whether this table contains any metadata for the specified type.

Namespace:  Microsoft.Windows.Design.Metadata
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

'Declaration
Public Function ContainsAttributes ( _
    type As Type _
) As Boolean
public bool ContainsAttributes(
    Type type
)
public:
bool ContainsAttributes(
    Type^ type
)
member ContainsAttributes : 
        type:Type -> bool 
public function ContainsAttributes(
    type : Type
) : boolean

Parameters

  • type
    Type: System.Type
    The type to check for metadata attributes.

Return Value

Type: System.Boolean
true if the table contains attributes for the specified type; otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

type is nulla null reference (Nothing in Visual Basic).

Remarks

The metadata may be class-level metadata or metadata associated with a DependencyProperty or MemberDescriptor. The designer uses this method to identify loaded types that need a Refreshed event raised when a new attribute table is added, and to quickly decide which tables should be queried further during attribute queries.

Examples

The following code example shows how to use the ContainsAttributes method to determine whether a type has custom attributes. This code example is part of a larger example provided for the AttributeTable class.

Dim hasCustomAttributes As Boolean = attributes.ContainsAttributes(GetType(Button))
bool hasCustomAttributes = attributes.ContainsAttributes(typeof(Button));

.NET Framework Security

See Also

Reference

AttributeTable Class

Microsoft.Windows.Design.Metadata Namespace

AttributeTableBuilder