“attribute1”需要“attribute2”
第一个函数特性需要第二个特性。
示例
如果尝试将委托绑定到采用可变数量参数的 CLR 函数,则可能会发生 C2217。 如果函数还有参数数组重载,请改用它。 以下示例生成 C2217。
// C2217.cpp
// compile with: /clr
using namespace System;
delegate void MyDel(String^, Object^, Object^, ...); // C2217
delegate void MyDel2(String ^, array<Object ^> ^); // OK
int main() {
MyDel2^ wl = gcnew MyDel2(Console::WriteLine);
array<Object ^ > ^ x = gcnew array<Object ^>(2);
x[0] = safe_cast<Object^>(0);
x[1] = safe_cast<Object^>(1);
// wl("{0}, {1}", 0, 1);
wl("{0}, {1}", x);
}