Stack.Count
using System;
using System.Collections;
public class Starter {
public static void Main() {
Stack numbers = new Stack(new int[] { 1, 2, 3, 4, 5, 6 });
int total = numbers.Count;
for (int count = 0; count < total; ++count) {
Console.WriteLine(numbers.Pop());
}
}
}
Related examples in the same category