Create new Array of parameter type
- by pimvdb
I'm trying to create a function to parse out all values in a multidimensional Array with all but one dimension given. The details are not relevant, but for this function I need to return an one-dimensional Array containing values of the same type the original multidimensional Array has.
To pass any Array with any dimension to my function, I declared the type of this parameter as Array. However, how would I create a new Array of that specific type (e.g. Integer)?
Currently I have the following code:
Function GetRow(ByVal arr As Array) As Array
Dim result As (...) 'This should be Integer() if arr contains Integers, etc.
Return result
End Function
How do I declare the type of result to make it having the same type of values as arr? New Array is not possible as it is declared MustInherit.
Thanks a lot.