ContextStack.Push(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
推入或放置指定物件至堆疊上。
public:
void Push(System::Object ^ context);
public void Push (object context);
member this.Push : obj -> unit
Public Sub Push (context As Object)
參數
- context
- Object
要推入至堆疊的內容物件。
例外狀況
context
為 null
。
範例
下列程式代碼範例示範如何將值推送至 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