UnscopedRefAttribute 類別

定義

用來指示 byref 逸出且未限定範圍。

public ref class UnscopedRefAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)]
public sealed class UnscopedRefAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)>]
type UnscopedRefAttribute = class
    inherit Attribute
Public NotInheritable Class UnscopedRefAttribute
Inherits Attribute
繼承
UnscopedRefAttribute
屬性

備註

在某些情況下,C# 編譯程式會將 ref 視為隱含 scoped ,其中編譯程式不允許 ref 逸出 方法。

例如:

  1. this 實例 struct 方法。
  2. ref 參考型別的參數 ref struct
  3. out 參數。

此屬性用於應該允許逸出的 ref 實例中。

以任何形式套用此屬性會影響適用 API 的取用者。 API 作者必須瞭解套用此屬性的存留期含意,以及可能會影響其使用者的方式。

建構函式

UnscopedRefAttribute()

初始化 UnscopedRefAttribute 類別的新執行個體。

屬性

TypeId

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

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

適用於