【发布时间】:2018-07-10 08:39:31
【问题描述】:
鉴于以下
public class Service<T> : IService<T>
{
Repository<T> _repository = new Repository<T>();
public T Get<T>(int id)
{
return _repository.Get<T>(id);
}
}
public interface IService<T>
{
T Get<T>(int id);
}
我收到以下警告
类型参数“T”同名 作为外部类型的类型参数 'Services.IService'
我不确定这是什么问题,为什么它关心我的返回类型是否与我告诉班级的类型相同。我在这里遗漏了什么吗?
【问题讨论】: