Прочетете на английски Редактиране

Споделяне чрез


Stack<T>.TryPop(T) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns a value that indicates whether there is an object at the top of the Stack<T>, and if one is present, copies it to the result parameter, and removes it from the Stack<T>.

C#
public bool TryPop(out T result);

Parameters

result
T

If present, the object at the top of the Stack<T>; otherwise, the default value of T.

Returns

true if there is an object at the top of the Stack<T>; false if the Stack<T> is empty.

Applies to

Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1