Delegate parameters...

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

In Delphi all the events that 'it' generates, e.g. a button click, there is
a default parameter Sender of type TObject, so whenever I defined my own I
always did that too, so now converting one of my programs to C# I am
wondering if it is a 'standard' that is generally adopted when defining
delegates in C#?

thoughts anyone?

cheers
Colin
 
Colin,

You'll have to be more careful with the SECOND argument of events than with
the first.
Events in C# have a first argument (Object sender) that work just like in
Delphi, but the second argument (EventArgs args) should be of the predefined
class EventArgs or a class created by yourself that inherits from EventArgs.
If your events supply some information to the outside world, you must create
your own EventArgs class.
This is much more OO than in Delphi, where the mouse events had a different
signature than keyboard events, etc.

Regards - Octavio
 
Hi Tim,

Many thanks for this the links proved extermely useful!

Cheers
Colin
 
Back
Top