No. You must use something like this:
public Array ReDim1DArray(Array origArray, int nNewSize)
{
// Determine the types of each element
Type objType = origArray.GetType().GetElementType();
// Construct a new array a different number of elements
// The new array preserves types from the original array
Array newArray = Array.CreateInstance(objType, nNewSize);
// Copy the original array elements to the new array
Array.Copy(origArray, 0, newArray, 0,
Math.Min(origArray.Length, nNewSize));
// Return the new array
return newArray;
}
This method then is called like this (using the 1-D array, myArray, from the previous code listing):
myArray = (string[]) ReDim1DArray(myArray, 3);
myArray[2] = "elem3";
Regards,
LC