title: Delegate with base and/or inherited class parameter
body: <p>I've got a system i'm working with that uses System.Action delegates to handle events, but have run into an issue with incompatible delegate types and am unsure the course of action to take. The below code is a close approximation of what's going on in the source.</p>
  
  <pre><code>Using System;
  
  //My base data object
  public class BasicData{
      public bool foo {get; private set;} = false;
  
      public BasicData(bool bData){
          foo = bData;
      }
  }
  
  //One of my extended data objects
  public class ComplexData : BasicData{
      public string bar {get; private set;} = "";
  
      public ComplexData (bool bData, string strData){
          foo = bData;
          bar = strData
      }
  }
  
  //One of the basic things doing work
  public class MyThing{
      public bool isAwake {get; private set;} = false;
      public Action&lt;BasicData&gt; OnDoesStuff;
      private BasicData data; //Used internally elsewhere
  
      protected virtual void DoThatStuff() {
          data = new BasicData(true);
          OnDoesStuff?.Invoke(data);
      }
  }
  
  //One of the more complex things doing work
  public class MyMoreComplexThing : MyThing{
      public new Action&lt;ComplexData&gt; OnDoesStuff;
      private new ComplexData data; //Used internally elsewhere
  
      protected override void DoThatStuff() {
          data = new ComplexData(true, "MMM, Tasty");
          OnDoesStuff?.Invoke(data);
      }
  }
  
  //Excerpt from one of the 'factory-like' managers
  public MyFactory{
      private List&lt;MyThing&gt; lstThings = new List&lt;MyThing&gt;();
  
      //Generic basic data callback
      //Other interested parties add their own data callbacks as needed
      public void RegisterBasic(BasicData callback) {
          for (int i = 0; i &lt; lstThings.Count; i++) {
              if(lstThings[i].isAwake){
                  lstThings[i].OnDoesStuff += callback;
              }
          }
      }
  }
  
  //Excerpt from one of the interested parties
  public InterestedParty{
      //populated somewhere else during initialization of the party
      private List&lt;MyMoreComplexThing &gt; lstComplexThings = new List&lt;MyMoreComplexThing &gt;();
  
      //Complex data callback
      public void WhatchaDoing(MyMoreComplexThing callback) {
          for (int i = 0; i &lt; lstComplexThings .Count; i++) {
              if(lstComplexThings [i].isAwake){
                  lstComplexThings [i].OnDoesStuff += callback;
              }
          }
      }
  }
  </code></pre>
  
  <p>The delegate assignment passes the compiler fine but fails at run-time for RegisterBasic() as it's unable to resolve the child parameter back to it's parent. I've got a feeling i really need to refactor to add, and better take into account, an OnDoesBasicStuff and an OnDoesMoreComplexStuff callback each.</p>