Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 泛型类型用作第二个接口中泛型类型的接口_C#_Generics - Fatal编程技术网

C# 泛型类型用作第二个接口中泛型类型的接口

C# 泛型类型用作第二个接口中泛型类型的接口,c#,generics,C#,Generics,我有一个引用接受泛型类型的接口: public interface IEntity<TType> public interface IRepository<T> : IDisposable where T : IEntity, new() 公共接口的可扩展性 我希望将此引用传递给采用泛型类型的第二个接口: public interface IEntity<TType> public interface IRepository<T> : ID

我有一个引用接受泛型类型的接口:

public interface IEntity<TType>
public interface IRepository<T> : IDisposable where T : IEntity, new()
公共接口的可扩展性
我希望将此引用传递给采用泛型类型的第二个接口:

public interface IEntity<TType>
public interface IRepository<T> : IDisposable where T : IEntity, new()
public interface IRepository:IDisposable其中T:IEntity,new()
我已经试着让它工作,但到目前为止还没有建立它


有什么方法可以做到这一点吗?

您的界面是
IEntity
,而不是
IEntity
。这意味着您的
i存款的签名需要反映以下内容:

public interface IEntity<TType>

public interface IRepository<T, TEntity> : IDisposable where T : IEntity<TEntity>, new()
公共接口的可扩展性
公共接口IRepository:IDisposable,其中T:IEntity,new()

到底是什么失败了?是否有错误消息?