ContextStack.Pop 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將目前物件從堆疊中移除,並傳回物件的值。
public:
System::Object ^ Pop();
public object Pop ();
public object? Pop ();
member this.Pop : unit -> obj
Public Function Pop () As Object
傳回
已從堆疊中移除的物件;如果堆疊中沒有物件,則為 null
。
範例
下列程式代碼範例示範如何從 ContextStack中移除值。
// Pop each item off the stack.
Object^ item = nullptr;
while ( (item = stack->Pop()) != 0 )
Console::WriteLine( "Value popped from stack: {0}", item );
// Pop each item off the stack.
object item = null;
while( (item = stack.Pop()) != null )
Console.WriteLine( "Value popped from stack: "+item.ToString() );
' Pop each item off the stack.
Dim item As Object = stack.Pop()
While item IsNot Nothing
Console.WriteLine(("Value popped from stack: " + item.ToString()))
item = stack.Pop()
End While