Mike,
As the others have suggested.
If boxing of value types is a concern, for an array of Integer (and other
value types) I would consider using Array.Copy to copy the elements before &
after the element that I was deleting.
Something like:
Private Shared Sub DeleteFromArray(ByRef aintABC() As Integer, ByVal
intIndex As Integer)
Dim result(aintABC.Length - 2) As Integer
Array.Copy(aintABC, 0, result, 0, intIndex)
Array.Copy(aintABC, intIndex + 1, result, intIndex,
aintABC.Length - intIndex - 1)
aintABC = result
End Sub
For an array of reference types or if boxing is not an issue. I would use an
ArrayList or a class derived from CollectionBase. More then likely I would
use an ArrayList, until performance was proven to be an issue via profiling.
When Whidbey (VS.NET 2005) ships we will have a generic ArrayList like class
where we will be able to delete from the middle of a collection of Integers,
without the expense of boxing the elements...
Hope this helps
Jay
"Mike" <y1***@yahoo.com> wrote in message
news:93**************************@posting.google.c om...
Hi,
I created such procedure for deleting element from my dynamic array
because I could not find such possibility from .Net .
Private aintABC() As Int32
'' Initialization somewhere in another procedure
Private Sub DeleteFromArray(ByVal intIndex As Integer)
Dim i As Integer
For i = intIndex + 1 To aintABC.Length - 1
aintABC(i - 1) = aintABC(i)
Next
ReDim Preserve aintABC(aintABC.Length - 2)
End Sub
Maybe somebody know how I can do it without iteration or .Net does not
have any standart decision.
Thanks