C# Stack Stack(Int32)
Description
Stack Stack(Int32)
initializes a new instance of the
Stack class that is empty and has the specified initial capacity or the default
initial capacity, whichever is greater.
Syntax
Stack.Stack(Int32)
has the following syntax.
public Stack(
int initialCapacity
)
Parameters
Stack.Stack(Int32)
has the following parameters.
initialCapacity
- The initial number of elements that the Stack can contain.
Example
/*from w w w. j av a 2s . c o m*/
using System;
using System.Collections;
public class SamplesStack {
public static void Main() {
Stack myStack = new Stack(10);
myStack.Push( "1" );
}
}
The code above generates the following result.