Java 的 getComponentType() 的 C# 等价物是什么?

What is the C# equivalent of Java's getComponentType()?

我正在从 Java 翻译成 C#,代码类似于:

T[] @unchecked = (T[])Array.newInstance(array.getClass().getComponentType(), sampleSize);

我知道 getClass() 在 C# 中等于 GetType()newInstance() 等于 CreateInstance();但是我不知道 getComponentType() 的 C# 等价物是什么?

试试这个,它会起作用 Array.CreateInstance(array.GetType().GetElementType(), sampleSize);