编译器错误 C3219

“param”: 泛型参数不能由多个非接口“class”进行约束

由两个或更多托管类约束泛型参数是无效的。

下面的示例生成 C3219:

// C3219.cpp
// compile with: /clr
ref class A {};
ref class B {};

generic <class T>
where T : A, B
ref class E {};   // C3219

以下示例演示了可能的解决方法:

// C3219b.cpp
// compile with: /clr /c
ref class A {};

interface struct C {};

generic <class T>
where T : A
ref class E {};