共用方式為


ContextStack.Push(Object) 方法

定義

推入或放置指定物件至堆疊上。

public:
 void Push(System::Object ^ context);
public void Push (object context);
member this.Push : obj -> unit
Public Sub Push (context As Object)

參數

context
Object

要推入至堆疊的內容物件。

例外狀況

contextnull

範例

下列程式代碼範例示範如何將值推送至 ContextStack

// Push ten items on to the stack and output the value of each.
for ( int number = 0; number < 10; number++ )
{
   Console::WriteLine( "Value pushed to stack: {0}", number );
   stack->Push( number );
}
// Push ten items on to the stack and output the value of each.
for( int number = 0; number < 10; number ++ )
{
    Console.WriteLine( "Value pushed to stack: "+number.ToString() );
    stack.Push( number );
}
' Push ten items on to the stack and output the value of each.
Dim number As Integer
For number = 0 To 9
    Console.WriteLine(("Value pushed to stack: " + number.ToString()))
    stack.Push(number)
Next number

適用於