interface containing events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    interface containing events

    I want interface, that in addition to providing methods declarion,
    also contain events:


    interface Connection{

    public event MyDelegateHandl er handler;
    public event MyDelegateHandl er2 handler2;

    public void Method1();
    public void Method2();
    }

    do you also think it's a good idea to create a separate interface for
    delegates and have connection class inherit from it?

    thanks
  • raylopez99

    #2
    Re: interface containing events

    On Oct 5, 4:42 pm, puzzlecracker <ironsel2...@gm ail.comwrote:
    I want interface, that in addition to providing methods declarion,
    also contain events:
    >
    interface Connection{
    >
        public event MyDelegateHandl er handler;
        public event MyDelegateHandl er2 handler2;
    >
        public void Method1();
        public void Method2();
    >
    }
    >
    do you also think it's a good idea to create a separate interface for
    delegates and have connection class inherit from it?
    >
    thanks
    In interface is simply a design specification. Like a virtual class
    in a base class that must be written in all derived classes. As for
    'good idea', I don't have an opinion. Why would not writing it be a
    'bad idea'?

    RL

    Comment

    • Peter Duniho

      #3
      Re: interface containing events

      On Sun, 05 Oct 2008 16:42:19 -0700, puzzlecracker <ironsel2000@gm ail.com>
      wrote:
      [...]
      do you also think it's a good idea to create a separate interface for
      delegates and have connection class inherit from it?
      If the events are logically unrelated to the methods, then yes...it would
      be better for them to be in a different interface. If they are logically
      related to the methods, then no...they should stay in the same interface.

      There's no inherent problem with having events in the same interface with
      other class members, nor are events any different from other class members
      as far as the interface is concerned. So the same reasoning you'd apply
      to the design of any interface would apply with respect to whether you
      include events as well.

      Pete

      Comment

      Working...