Compiler Error C3350
'delegate' : a delegate constructor expects number argument(s)
When you create an instance of a delegate, you must pass two arguments, an instance of the type containing the delegate function, and the function.
The following sample generates C3350:
// C3350.cpp
// compile with: /clr
delegate void SumDelegate();
public ref class X {
public:
void F() {}
static void F2() {}
};
int main() {
X ^ MyX = gcnew X();
SumDelegate ^ pSD = gcnew SumDelegate(); // C3350
SumDelegate ^ pSD1 = gcnew SumDelegate(MyX, &X::F);
SumDelegate ^ pSD2 = gcnew SumDelegate(&X::F2);
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for