Remove item from array in VB.net

Remove item from array in VB.net:
Ta bort sak från array i vb.net

'1. order is not preserved In this approach, but very simple
MyArray(ItemToBeDeleted) = MyArray( Ubound (MyArray))
Redim Preserve MyArray( Ubound (MyArray) - 1)

'2. order Is maintained
Dim i As Long , N As Long
'assumes N is the position In MyArray to remove
For i = N To Ubound (MyArray) - 1
MyArray(i) = MyArray(i + 1)
Next i
Redim Preserve MyArray( Ubound (MyArray) - 1)