Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3350

Error Message

'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);
}

Managed Extensions for C++

The following sample generates C3350:

// C3350b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__delegate void SumDelegate();

public __gc class X {
public:
   void F() {}
   static void F2() {}
};

int main() {
   X * MyX = new X();
   SumDelegate *pSD = new SumDelegate();   // C3350
   SumDelegate *pSD1 = new SumDelegate(MyX, &X::F);
   SumDelegate *pSD2 = new SumDelegate(&X::F2);
}

Community Additions

ADD
Show:
© 2015 Microsoft