RequiresUnreferencedCodeAttribute 类

定义

指示指定方法需要对未静态引用的代码进行动态访问,例如,通过 System.Reflection

public ref class RequiresUnreferencedCodeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed class RequiresUnreferencedCodeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed class RequiresUnreferencedCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)>]
type RequiresUnreferencedCodeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)>]
type RequiresUnreferencedCodeAttribute = class
    inherit Attribute
Public NotInheritable Class RequiresUnreferencedCodeAttribute
Inherits Attribute
继承
RequiresUnreferencedCodeAttribute
属性

注解

此属性允许工具了解从应用程序中删除未引用的代码时要调用的方法不安全。 如需更多信息, 请参阅 剪裁警告简介。

构造函数

名称 说明
RequiresUnreferencedCodeAttribute(String)

使用指定的消息初始化类的新实例 RequiresUnreferencedCodeAttribute

属性

名称 说明
ExcludeStatics

获取或设置一个值,该值指示批注是否应用于静态成员。

Message

获取一条消息,其中包含有关未引用代码用法的信息。

TypeId

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

(继承自 Attribute)
Url

获取或设置一个可选 URL,其中包含有关该方法的详细信息、为何需要未引用的代码,以及使用者必须处理哪些选项。

方法

名称 说明
Equals(Object)

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

(继承自 Attribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

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

(继承自 Attribute)
Match(Object)

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

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

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

(继承自 Object)

适用于

另请参阅