[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Calling undeclared 'virtual' methods..

From: Rhys Weatherley
Subject: Re: [DotGNU]Calling undeclared 'virtual' methods..
Date: Fri, 06 Dec 2002 07:35:25 +1000

Chris Smith wrote:
> is it possible to do this in C#:
> SomeClass OBJ = new SomeClass();
> OBJ.Method.some.false.method( .... );

Probably not.

I'm not familiar with how Goldwater works, but maybe you can
turn the message passing system around and create an event
system for messages instead.

e.g. message consumers register for specific types of messages
from a message provider.

C# can support this, using the event syntax.

public delegate void MessageType(...parameters...)

public class Provider
    public event MessageType Message;

    private void foo()
        // emit the message
        if(Message != null)


public class Consumer
    public void Register(Provider p)
        p.Message += new MessageType(handler);

    private void handler(...parameters...)
        // handle the message

Just a suggestion.  Maybe it isn't possible to rearrange things
like this, but may be worth giving a little thought to.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]