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
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiáveis.
Consulte também
Referência
Sobrecargas GetCustomAttributes