[Mono-winforms-list] Is it possible to overload the System.EventHandler?

Sanford Armstrong sanfordarmstrong at gmail.com
Sat Feb 3 15:59:40 EST 2007


On 2/3/07, Paul <paul at all-the-johnsons.co.uk> wrote:
> Hi,
>
> I've googled for this for a while now, but can't seem to find a way to
> do it.
>
> I'm trying to pass more than one argument on a line like
>
> this.foo.TextChanged += new System.EventHandler(this.foo_TextChanged,
> arg2);
>
> where arg2 can be just about anything. Any hints would be appreciated.

Doing exactly what you describe is not possible.  If you explain what
your goal is, then we might be able to suggest ways to achieve it.

When signing up for an event, all you are doing is adding a method
(that has the exact signature of a particular delegate -- in this
case, System.EventHandler) to a list of methods that will be called
when the event is fired.  So all you can do is add and remove methods
from the event, and the methods MUST have the right signature.

What do you want to do with arg2?  I am sure there is a way to get
foo_TextChanged to be aware of it.

Best,
Sandy


More information about the Mono-winforms-list mailing list