Create new Array of parameter type
Posted
by
pimvdb
on Stack Overflow
See other posts from Stack Overflow
or by pimvdb
Published on 2011-01-04T19:42:25Z
Indexed on
2011/01/04
19:54 UTC
Read the original article
Hit count: 196
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.
© Stack Overflow or respective owner