ContextStack.Item[] Property

Definition

Gets or sets the object on the stack at the specified level.

Overloads

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]

Source:
ContextStack.cs
Source:
ContextStack.cs
Source:
ContextStack.cs

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; }
public object? this[int level] { get; }
member this.Item(int) : obj
Default Public ReadOnly Property Item(level As Integer) As Object

Parameters

level
Int32

The level of the object to retrieve on the stack. Level 0 is the top of the stack, level 1 is the next down, and so on. This level must be 0 or greater. If level is greater than the number of levels on the stack, it returns null.

Property Value

The object on the stack at the specified level, or null if no object exists at that level.

Exceptions

level is less than 0.

Applies to

Item[Type]

Source:
ContextStack.cs
Source:
ContextStack.cs
Source:
ContextStack.cs

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

Parameters

type
Type

A type to retrieve from the context stack.

Property Value

The first object on the stack that inherits from or implements the specified type, or null if no object on the stack implements the type.

Exceptions

type is null.

Remarks

A 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.

Applies to