METHOD
Stack.TryPop
Removes the top item if present; false reports an empty stack.
Formal Syntax & Structure
csharp syntaxcsharp
bool TryPop(out T result)Working Example
Example Snippetcsharp
using System.Collections.Generic;var s = new Stack<int>();System.Console.WriteLine(s.TryPop(out _));