次のクラス定義があります。
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>
ですか? これを解決するにはどうすればよいですか?