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
屬性

備註

此屬性讓工具了解在移除應用程式中未被引用程式碼時,哪些方法不安全呼叫。 如需詳細資訊,請參閱 修剪警告簡介。

建構函式

名稱 Description
RequiresUnreferencedCodeAttribute(String)

初始化一個新的類別實例 RequiresUnreferencedCodeAttribute ,並以指定訊息進行。

屬性

名稱 Description
ExcludeStatics

取得或設定一個值,指示註解是否應適用於靜態成員。

Message

會收到一則包含未引用程式碼使用資訊的訊息。

TypeId

在衍生類別中實作時,取得這個 Attribute的唯一標識碼。

(繼承來源 Attribute)
Url

取得或設定一個可選的網址,包含更多關於方法的資訊、為何需要未引用的程式碼,以及消費者可選擇的處理方式。

方法

名稱 Description
Equals(Object)

傳回值,這個值表示這個實例是否等於指定的物件。

(繼承來源 Attribute)
GetHashCode()

傳回這個實例的哈希碼。

(繼承來源 Attribute)
GetType()

取得目前實例的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,指出這個實例的值是否為衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於

另請參閱