Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pop off array in C#

Tags:

arrays

c#

I've got a string array in C# and I want to pop the top element off the array (ie. remove the first element, and move all the others up one). Is there a simple way to do this in C#? I can't find an Array.Pop method.

Would I need to use something like an ArrayList? The order of the items in my array is important.

like image 400
robintw Avatar asked Jan 18 '09 14:01

robintw


People also ask

How do you delete an array?

Array elements can be deleted using the JavaScript operator delete . Using delete leaves undefined holes in the array. Use pop() or shift() instead.

What is deletion in array?

Deletion refers to removing an existing element from the array and re-organizing all elements of an array.


1 Answers

Use a List, Queue or Stack instead..

List<String> Queue<String> Stack<String> 
like image 88
driAn Avatar answered Oct 06 '22 00:10

driAn