Check if array is multidimensional

since I am implementing ICollection-Interface in my class, I want to implement CopyTo-Method, and I have to throw an Argument exception if the array is multi-dimensional. What is meant by this? The head of my method is

public void CopyTo (array MyClass [], int arrayIndex)

I thought that these brackets mean that this array is one-dimensional, but when I automatically import comments from the interface, a comment appears that I have to check for multidimensionality. Can someone explain this to me?

Yours faithfully

Sebastia

+3
source share
1 answer

Can you look at Array.Rank? However, T [] is one-dimensional. Basically you need to check the rank when all you know is an Array. This is because the actual method is displayed via Array, not T [].

So, briefly - do not worry about this in this scenario; -p

+3
source

All Articles