Método AttributeTable.GetCustomAttributes (Type)

Retorna uma enumeração de todos os atributos fornecidos para o tipo especificado.

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

Sintaxe

'Declaração
Public Function GetCustomAttributes ( _
    type As Type _
) As IEnumerable
public IEnumerable GetCustomAttributes(
    Type type
)
public:
IEnumerable^ GetCustomAttributes(
    Type^ type
)
member GetCustomAttributes : 
        type:Type -> IEnumerable 
public function GetCustomAttributes(
    type : Type
) : IEnumerable

Parâmetros

  • type
    Tipo: System.Type
    O tipo de obter os atributos de nível de classe do.

Valor de retorno

Tipo: System.Collections.IEnumerable
Uma enumeração de atributos.

Exceções

Exceção Condição
ArgumentNullException

type is nulluma referência nula (Nothing no Visual Basic).

Comentários

Este método nunca retorna um nulluma referência nula (Nothing no Visual Basic) enumeração.

Exemplos

O exemplo de código a seguir mostra como usar o GetCustomAttributes método para obter os atributos personalizados para um tipo. This code example is part of a larger example provided for the AttributeTable class.

Dim attrs0 As IEnumerable = attributes.GetCustomAttributes(GetType(Button))
IEnumerable attrs0 = attributes.GetCustomAttributes(typeof(Button));

Segurança do .NET Framework

Consulte também

Referência

AttributeTable Classe

Sobrecargas GetCustomAttributes

Namespace Microsoft.Windows.Design.Metadata

AttributeTableBuilder