Lambda expressions as CLR (.NET) delegates / event handlers in Visual C++ 2010
- by absence
Is it possible to use the new lambda expressions in Visual C++ 2010 as CLR event handlers? I've tried the following code:
SomeEvent += gcnew EventHandler(
[] (Object^ sender, EventArgs^ e) {
// code here
}
);
It results in the following error message:
error C3364: 'System::EventHandler' : invalid argument for delegate constructor; delegate target needs to be a pointer to a member function
Am I attempting the impossible, or is simply my syntax wrong?