編譯器錯誤 C3390
'type_arg':泛型 'generic_type' 泛型參數 'param' 的類型自變數無效,必須是引用類型
泛型類型未正確地具現化。 請檢查類型定義。
備註
如需詳細資訊,請參閱泛型。
範例
第一個範例會使用 C# 來建立包含泛型類型的元件。 此類型具有在 C++/CLI 中撰寫泛型類型時不支援的特定條件約束。 如需詳細資訊,請參閱型別參數的條件約束。
// C3390.cs
// Compile by using: csc /target:library C3390.cs
// a C# program
public class GR<C, V, N>
where C : class
where V : struct
where N : new() {}
當C3390.dll元件可供使用時,下列範例會產生 C3390。
// C3390_b.cpp
// Compile by using: cl /clr C3390_b.cpp
#using <C3390.dll>
ref class R { R(int) {} };
value class V {};
ref struct N { N() {} };
int main () {
GR<V, V, N^>^ gr2; // C3390 first type must be a ref type
GR<R^, V, N^>^ gr2b; // OK - do this instead
}