Share via


ContextStack.Item[] 属性

定义

获取或设置堆栈上指定级别的对象。

重载

Item[Int32]

获取堆栈上指定级别的对象。

Item[Type]

获取堆栈上从指定类型继承或者实现指定类型的第一个对象。

Item[Int32]

Source:
ContextStack.cs
Source:
ContextStack.cs
Source:
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]

Source:
ContextStack.cs
Source:
ContextStack.cs
Source:
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。 如果找到匹配项,则返回该匹配项。

适用于