ArrayList alArray = new ArrayList();for ( int i = 0; i < myArray.Length; ++i )
{
if ( myArray[i] != null )
alArray.Add(myArray[i]);
}
Or maybe, if you want to remove null value objects:
for ( int i = 0; i < myArrayList.Length; i++ )
{
if (myArrayList[i] == null )
myArrayList.RemoveAt[i]);
}
The ArrayList is in many ways extremely practical, as you don't have to redim the size. You just simply remove the unwanted elements.
0 comments:
Post a Comment