I have the following class definition:
public class Registry
{
private List<Action<IThing>> _thingActions = new List<Action<IThing>>();
public Register<TDerivedThing>(Action<TDerivedThing> thingAction)
where TDerivedThing : IThing
{
// this line causes compilation issue
_thingActions.Add(thingAction);
}
}
Why does this complain that it cannot assign Action<TDerivedThing>
to Action<IThing>
, and how should I go about resolving this?