![]() Initializes a new instance of the Stack class that contains elements copied from the specified collection and has the same initial capacity as the number of elements copied. Initializes a new instance of the Stack class that is empty and has the default initial capacity. Stack accepts null as a valid value and allows duplicate elements. If the capacity needs to be increased to accommodate the new element, Push becomes an O(n) operation, where n is Count. If Count is less than the capacity of the stack, Push is an O(1) operation. For more information, see Non-generic collections shouldn't be used on GitHub. Instead, we recommend that you use the generic class. We don't recommend that you use the Stack class for new development. As elements are added to a Stack, the capacity is automatically increased as required through reallocation. The capacity of a Stack is the number of elements the Stack can hold. ' This code produces the following output. Public Shared Sub PrintValues(m圜ollection As IEnumerable) Displays the properties and values of the Stack.Ĭonsole::WriteLine( "\tCount: ", myStack.Count)Ĭonsole.Write(ControlChars.Tab & "Values:") Void PrintValues( IEnumerable^ m圜ollection ) The following example shows how to create and add values to a Stack and how to display its values. ICollection IEnumerable ICloneable Examples Implements ICloneable, ICollection Inheritance ![]() ![]() Implements ICollection Public Class Stack Public class Stack : ICloneable, type Stack = class public ref class Stack : System::Collections::ICollection public ref class Stack : ICloneable, System::Collections::ICollection public class Stack : public class Stack : ICloneable, Represents a simple last-in-first-out (LIFO) non-generic collection of objects.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |