नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'type_arg' : invalid type argument for generic parameter 'param' of generic 'generic_type', must be a reference type
Remarks
A generic type was instantiated incorrectly. Check the type definition.
For more information, see Generics.
Example
The first example uses C# to create a component that contains a generic type. This type has certain constraints that aren't supported when authoring generic types in C++/CLI. For more information, see Constraints on Type Parameters.
// 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() {}
When the C3390.dll component is available, the following example generates 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
}