以下代码无法编译:
protected override ITaskScheduleAlgorithm<CollectionTask, ICoordinationExecutionService<CollectionTask>> GetAlgorithm()
{
return new SimpleTaskScheduleAlgorithm<CollectionTask, WorkerServiceConfiguration>();
}
错误是:
无法隐式转换类型...
无法转换的类型:
WorkerServiceConfiguration → ICoordinationExecutionService
虽然 WorkerServiceConfiguration 类继承自ICoordinationExecutionService:
public class WorkerServiceConfiguration : AbstractServiceConfiguration<CollectionTask>
{
...
}
public abstract class AbstractServiceConfiguration<TTask> : ICoordinationExecutionService<TTask>
{
...
}
知道为什么会发生以及如何解决吗?