CustomAttributeExtensions.IsDefined Método

Definición

Indica si los atributos personalizados se aplican a un elemento.

Sobrecargas

IsDefined(MemberInfo, Type, Boolean)

Indica si los atributos personalizados de un tipo especificado se aplican a un miembro especificado y, opcionalmente, se aplican a sus antecesores.

IsDefined(Assembly, Type)

Indica si se deben aplicar atributos personalizados de un tipo especificado a un ensamblado especificado.

IsDefined(MemberInfo, Type)

Indica si se deben aplicar atributos personalizados de un tipo especificado a un miembro especificado.

IsDefined(Module, Type)

Indica si se deben aplicar atributos personalizados de un tipo especificado a un módulo especificado.

IsDefined(ParameterInfo, Type)

Indica si se deben aplicar atributos personalizados de un tipo especificado a un parámetro especificado.

IsDefined(ParameterInfo, Type, Boolean)

Indica si los atributos personalizados de un tipo especificado se aplican a un parámetro especificado y, opcionalmente, se aplican a sus antecesores.

IsDefined(MemberInfo, Type, Boolean)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si los atributos personalizados de un tipo especificado se aplican a un miembro especificado y, opcionalmente, se aplican a sus antecesores.

C#
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType, bool inherit);

Parámetros

element
MemberInfo

Miembro que se va a inspeccionar.

attributeType
Type

Tipo del atributo que se va a buscar.

inherit
Boolean

Es true para inspeccionar los antecesores de element; de lo contrario, es false.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

element no es un constructor, método, propiedad, evento, tipo o campo.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

IsDefined(Assembly, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si se deben aplicar atributos personalizados de un tipo especificado a un ensamblado especificado.

C#
public static bool IsDefined (this System.Reflection.Assembly element, Type attributeType);

Parámetros

element
Assembly

Ensamblado que se va a inspeccionar.

attributeType
Type

Tipo del atributo que se va a buscar.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

IsDefined(MemberInfo, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si se deben aplicar atributos personalizados de un tipo especificado a un miembro especificado.

C#
public static bool IsDefined (this System.Reflection.MemberInfo element, Type attributeType);

Parámetros

element
MemberInfo

Miembro que se va a inspeccionar.

attributeType
Type

El tipo de atributo que se va a buscar.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

element no es un constructor, método, propiedad, evento, tipo o campo.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

IsDefined(Module, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si se deben aplicar atributos personalizados de un tipo especificado a un módulo especificado.

C#
public static bool IsDefined (this System.Reflection.Module element, Type attributeType);

Parámetros

element
Module

Módulo que se va a inspeccionar.

attributeType
Type

El tipo de atributo que se va a buscar.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

IsDefined(ParameterInfo, Type)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si se deben aplicar atributos personalizados de un tipo especificado a un parámetro especificado.

C#
public static bool IsDefined (this System.Reflection.ParameterInfo element, Type attributeType);

Parámetros

element
ParameterInfo

Parámetro que se va a inspeccionar.

attributeType
Type

El tipo de atributo que se va a buscar.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

IsDefined(ParameterInfo, Type, Boolean)

Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs
Source:
CustomAttributeExtensions.cs

Indica si los atributos personalizados de un tipo especificado se aplican a un parámetro especificado y, opcionalmente, se aplican a sus antecesores.

C#
public static bool IsDefined (this System.Reflection.ParameterInfo element, Type attributeType, bool inherit);

Parámetros

element
ParameterInfo

Parámetro que se va a inspeccionar.

attributeType
Type

El tipo de atributo que se va a buscar.

inherit
Boolean

Es true para inspeccionar los antecesores de element; de lo contrario, es false.

Devoluciones

Es true si un atributo del tipo especificado se aplica a element; de lo contrario, es false.

Excepciones

element o attributeType es null.

attributeType no se deriva de Attribute.

Se aplica a

.NET 9 y otras versiones
Producto Versiones
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0