tags:

views:

78

answers:

1

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                
    };
+4  A: 

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) => {...}
Marc Gravell
Thanks! that was quick ;)
Sorskoot