3 ms·
For anonymous - GUI event-handlers/callbacks. Say in MFC, or wxWidgets, or similar you have to explicitly say this even tones to this function, with anonymous
by malkia 15y ago
For anonymous - GUI event-handlers/callbacks.
Say in MFC, or wxWidgets, or similar you have to explicitly say this even tones to this function, with anonymous functions this is easier, you can just "inline it". If I'm not wrong, in .NET something like this:
With functions (.NET, C# kind of)
button1.Click += new EventHandler(OnButton1Clicked)
somewhere you would have to declare OnButton1Clicked
with anonymous function:
button1.Click += delegate(Event e) { Console.WriteLine(e.ToString()); };
or for newer .NET (both of my examples might be wrong, check the docs)
button1.Click += (e) { Console.WriteLine(e.ToString()); };
but what the other folks said in answers to you is how most of the time anonymous were used - map/reduce type of situations, or your "C" sort() if you can plug anonymous there.