ContextStack.Item[] 属性

定义

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

重载

名称 说明
Item[Int32]

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

Item[Type]

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

Item[Int32]

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

适用于