Share via


ContextStack.Item[] 屬性

定義

取得或設定指定層次堆疊上的物件。

多載

Item[Int32]

取得所指定層次之堆疊上的物件。

Item[Type]

取得在堆疊上繼承自或實作指定型別的第一個物件。

Item[Int32]

來源:
ContextStack.cs
來源:
ContextStack.cs
來源:
ContextStack.cs

取得所指定層次之堆疊上的物件。

public:
 property System::Object ^ default[int] { System::Object ^ get(int level); };
public object this[int level] { get; }
public object? this[int level] { get; }
member this.Item(int) : obj
Default Public ReadOnly Property Item(level As Integer) As Object

參數

level
Int32

要在堆疊上擷取的物件層次。 第 0 層是堆疊的最上層,第 1 層則是下一層,依此類推。 這一層必須是 0 或更大的值。 如果層次數字大於堆疊層次的數字,就會傳回 null

屬性值

指定層次堆疊上的物件,或 null (如果該層次上沒有物件存在)。

例外狀況

level 小於 0。

適用於

Item[Type]

來源:
ContextStack.cs
來源:
ContextStack.cs
來源:
ContextStack.cs

取得在堆疊上繼承自或實作指定型別的第一個物件。

public:
 property System::Object ^ default[Type ^] { System::Object ^ get(Type ^ type); };
public object this[Type type] { get; }
member this.Item(Type) : obj
Default Public ReadOnly Property Item(type As Type) As Object

參數

type
Type

要從內容堆疊中擷取的型別。

屬性值

在堆疊上繼承自或實作指定型別的第一個物件,或 null (如果在堆疊上沒有物件實作該型別)。

例外狀況

typenull

備註

會在堆疊的每個層級上進行檢查,搜尋實作或繼承 type的物件。 如果找到相符專案,則會傳回。

適用於