我有以下类定义:
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);
}
}
为什么这抱怨它不能分配Action<TDerivedThing>
给Action<IThing>
,我应该如何解决这个问题?