Errore del compilatore C2217
'attribute1' richiede 'attribute2'
Il primo attributo della funzione richiede il secondo attributo.
Esempio
L'errore C2217 può verificarsi se si tenta di associare un delegato a una funzione CLR che accetta un numero variabile di argomenti. Se la funzione ha anche un overload di matrice param, usarlo. L'esempio seguente genera l'errore 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);
}