Use of .Peek , .Clone and .CopyTo in Stack and Queue in C# language?
please answer these questions
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
CrishRank #1,487 · 1.1K reputationPosted May 24, 2010, 9:31 PM EDT
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