DynamicallyAccessedMembersAttribute 类

定义

指示通过 Type动态访问指定 System.Reflection 上的某些成员。

public ref class DynamicallyAccessedMembersAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct, Inherited=false)]
public sealed class DynamicallyAccessedMembersAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed class DynamicallyAccessedMembersAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct, Inherited=false)>]
type DynamicallyAccessedMembersAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)>]
type DynamicallyAccessedMembersAttribute = class
    inherit Attribute
Public NotInheritable Class DynamicallyAccessedMembersAttribute
Inherits Attribute
继承
DynamicallyAccessedMembersAttribute
属性

注解

此属性允许工具了解在执行程序期间访问的成员。 此属性对类型为 TypeString. 的成员有效。 当此属性应用于类型的 String某个位置时,假设字符串表示完全限定的类型名称。 如果特性应用于方法,则它被视为一种特殊情况,这意味着该属性应应用于方法的“this”参数。 该属性只应用于可 Type 分配给的类型的实例方法(或者 string,但不会在该处使用任何方法)。 如需更多信息, 请参阅 剪裁警告简介。

构造函数

名称 说明
DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes)

使用指定的成员类型初始化类的新实例 DynamicallyAccessedMembersAttribute

属性

名称 说明
MemberTypes

获取 DynamicallyAccessedMemberTypes 指定动态访问成员的类型。

TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
Equals(Object)

返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅