Does anyone know if there is way to get the sender and the eventarguments passed to an event when using an inline delegate like below?
p.Click+=delegate
{
//do some stuff
};
Does anyone know if there is way to get the sender and the eventarguments passed to an event when using an inline delegate like below?
p.Click+=delegate
{
//do some stuff
};
Well, you can declare it:
p.Click += delegate (object sender, EventArgs args) {...}
and use them as sender
and args
.
Or with lambdas:
p.Click += (sender, args) => {...}