GenericTypeParameterBuilder.GetElementType 方法

定義

在所有情況下都擲回 NotSupportedException

C#
public override Type? GetElementType();
C#
public override Type GetElementType();

傳回

目前陣列類型、指標類型或 ByRef 類型所參考的類型;如果目前類型不是陣列類型和指標類型,而且不是以傳址方式傳遞,則為 null

例外狀況

在所有情況下。

備註

泛型型別參數是型別的佔位元。 因為無法事先知道該類型,所以無法知道它是否有項目類型或該元素類型可能是什麼。 任何傳回值都會產生誤導,因此方法會 NotSupportedException擲回 。

適用於

產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1