How do I get the parameters of a built-in delegate?
Does anyone know if there is a way to get the sender and eventarguments passed to the event when using the built-in delegate like below?
p.Click+=delegate
{
//do some stuff
};
+1
Sorskoot
source
to share
1 answer
Well, you can declare this:
p.Click += delegate (object sender, EventArgs args) {...}
and use them as sender
and args
.
Or with lambdas:
p.Click += (sender, args) => {...}
+4
Marc gravell
source
to share