// Returns the object at the top of the System::Collections::Generic::Stack<T> without removing it.
// Returns
// The object at the top of the System::Collections::Generic::Stack<T>.
virtualT&Peek();
{
sassert(size!=0,"");
return_array[_size-1];
}
// Removes and returns the object at the top of the System::Collections::Generic::Stack<T>.
// Returns
// The object removed from the top of the System::Collections::Generic::Stack<T>.
virtualT&Pop()
{
sassert(size!=0,"");
_version++;
Tlocal=_array[--_size];
_array[_size]=NULL;
returnlocal;
}
// Inserts an object at the top of the System::Collections::Generic::Stack<T>.
// item
// The object to push onto the System::Collections::Generic::Stack<T>. The value can be null for reference types.
virtualvoidPush(T&obj)
{
_array[_size]=obj;
_size++;
_version++;
}
// Copies the System::Collections::Generic::Stack<T> to a new array.
// Returns
// A new array containing copies of the elements of the System::Collections::Generic::Stack<T>.
virtualT*ToArray()
{
T[]localArray=newT[_size];
for(inti=0;i<_size;i++)
{
localArray[i]=_array[(_size-i)-1];
}
returnlocalArray;
}
// Sets the capacity to the actual number of elements in the System.Collections.Generic.Stack<T1>, if that number is less than 90 percent of current capacity.