use of .Peek , .Clone and .CopyTo in Stack and Queue in C# language?
please answer these questions
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
CrishPosted May 25, 2010, 1:31 AM
Uses of .Peek , .Clone and .CopyTo in Stack and Queue in C# language?
STACK
Stack class is generally referred to as LIFO (Last In First Out). The best example could be "a stack of plates in the fabrication company". The last plate placed on the stack is the first one to be removed. Stack in implemented as circular buffer. The various methods of stack class are
Push
Inserts an object at the top of the Stack
Pop
Returns and permanently removes the object at the top of the Stack
Peek
Returns the object at the top of the Stack without removing it
Clear
Clears the stack by removing all objects from the Stack
Clone
Creates a shallow copy of the Stack
CopyTo
Copies the Stack to an existing one-dimensional Array
ToArray
Copies the Stack to a new array
Contains
Determines if an element is present in the Stack
Equals
Determines if two Object instances are equal
ToString
Returns a String that represents the current Object
GetEnumerator, GetHashCode and GetType are also some of the methods of stack class.
Count, IsReadOnly, IsSynchronized, SyncRoot are the properties of Stack class.
please also go through this link http://www.blackwasp.co.uk/Stack.aspx
Don't forget to Mark Do you like this Answer that solved your problem!
thanks