ContextStack.Item[] 属性

定义

获取或设置堆栈上指定级别的对象。Gets or sets the object on the stack at the specified level.

重载

Item[Int32]

获取堆栈上指定级别的对象。Gets the object on the stack at the specified level.

Item[Type]

获取堆栈上从指定类型继承或者实现指定类型的第一个对象。Gets the first object on the stack that inherits from or implements the specified type.

Item[Int32]

获取堆栈上指定级别的对象。Gets the object on the stack at the specified level.

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

参数

level
Int32

要在堆栈上检索的对象的级别。The level of the object to retrieve on the stack. 级别 0 是堆栈的顶级,级别 1 是接下来的一级,依次类推。Level 0 is the top of the stack, level 1 is the next down, and so on. 此级别必须大于或等于 0。This level must be 0 or greater. 如果级别大于该堆栈上的级别数,它返回 nullIf level is greater than the number of levels on the stack, it returns null.

属性值

Object

堆栈上指定级别的对象,或者在该级别不存在任何对象则为 nullThe object on the stack at the specified level, or null if no object exists at that level.

例外

level 小于 0。level is less than 0.

适用于

Item[Type]

获取堆栈上从指定类型继承或者实现指定类型的第一个对象。Gets the first object on the stack that inherits from or implements the specified type.

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

要从上下文堆栈检索的类型。A type to retrieve from the context stack.

属性值

Object

堆栈上从指定类型继承或者实现指定类型的第一个对象,或者如果在堆栈上没有任何对象实现此类型则为 nullThe first object on the stack that inherits from or implements the specified type, or null if no object on the stack implements the type.

例外

typenulltype is null.

注解

在堆栈的每个级别上进行检查,搜索实现或继承的对象 typeA check is made on each level of the stack, searching for an object that implements or inherits type. 如果找到匹配项,则返回。If a match is found, it is returned.

适用于