Timwi's solution should work fine. You can do something a bit simpler using Linq:
object[] newArray = sourceArray.Cast<object>().ToArray();
In case you need to recreate a System.Object[*]
to pass it back to VFP, you can use this overload of the Array.CreateInstance
method:
public static Array CreateInstance(
Type elementType,
int[] lengths,
int[] lowerBounds
)
You can use it as follows:
object[] normalArray = ...
// create array with lower bound of 1
Array arrayStartingAt1 =
Array.CreateInstance(
typeof(object),
new[] { normalArray.Length },
new[] { 1 });
Array.Copy(normalArray, 0, arrayStartingAt1, 1, normalArray.Length);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…