title: Inject delegate method from derived to base class using constructor
body: <p>Today I was re-factoring a library that I created and share code across multiple platforms (WPF, WF, WP7, WP8).</p>
  
  <p>The idea is that I use inheritance to extend functionality in classes. The top class expose couple of events to the client, this event is raised in a method that is passed down to the base class using the constructors that accept some parameters.</p>
  
  <p>The object is basically used as a singleton.</p>
  
  <p>Example:</p>
  
  <pre><code>public class SomeHandler : BaseHandler
  {
     public event EventHandler&lt;Custom1EventArgs&gt; RequestCompleted = delegate {};
     public event EventHandler&lt;Custom2EventArgs&gt; ActionHandled = delegate { };
  
     protected SomeHandler()
        : base(new CustomUtil(), new CustomRepository(), 
         new AnotherRepository(ADelegateMethod), 
         AnotherDelegateMethod, AnotherOneDelegateMethod) {}
  
     #region [ Singleton ]
     public static SomeHandler Instance
        {   get { return Nested.instance;}  }
  
     class Nested
     {
         internal static readonly SomeHandler instance = new SomeHandler ();
     }
     #endregion
  
     private static void ADelegateMethod(Custom1EventArgs args)
     {
        Instance.RequestCompleted (Instance, args);
     }
  
     private static void AnotherDelegateMethod(
         Custom2EventArgs args, CustomObject result)
     {
         // Do stuff....
         AnotherCustomObject cusObj = new AnotherCustomObject(args);
         Instance.ActionHandled (Instance, cusObj);
     }
  
     private static void AnotherOneDelegateMethod(CustomObject result)
     {
         // Do some stuff...
     }
  }
  </code></pre>
  
  <p>OK, if you have noticed, I need to mark the delegate methods as static because the inject is happened in the constructor parameters. But this forced me to make the events static. To workaround I relied to the fact that the user is always using the <code>Instance</code> singleton instance of my object, though the object can be initialized if they want, <code>sealed</code> is not an option at the moment because it is also used as base inherited class to another class in a specific special implementation.</p>
  
  <p>Is it bad to change the events to static? It doesn't seem proper to me, what do you think?
  Can this design get better?</p>
  
  <p>Actually I use the delegates as a part of code that needs to be executed in a specific time from other objects <code>new AnotherRepository(ADelegateMethod)</code> or the <code>BaseHandler</code> class so i can basically provide the client with information.</p>