I need to pass an array to a function in C# where the array may be a string[], int[], or double[] and may be 1 to multiple dimensions.
Reasoning:
I am needing to pass an array to a function to calculate its length, similar to:
public int getLength(array[] someArray, int dimension)
{
if(dimension > 0) //get length of dimension
return someArray.getLength(dimension);
else //get length of entire array
return someArray.Length;
}
Question:
How can I pass a generic array?
Or
Is there a better way to do this - say convert the array to a List?