에서 제네릭 형식 매개 변수를 사용하는 방법 나는C#을 인터페이스
public interface IPersistedModel<TModel, TIdentifier>
가 나는 위의 제네릭 형식 매개 변수를 사용하는 일반적인 방법이 인터페이스를 정의하고 싶습니다있다. 이것을 할 수있는 방법이 있습니까? 나는 다음을 시도했지만 어느 것도 컴파일하지 않는다.
public interface IModelCollection1<IPersistedModel<TModel, TIdentifier>>
{
IEnumerable<TModel> ReadCollection(TIdentifier identifier);
}
또는
public interface IModelCollection2<T> where T : IPersistedModel<TModel, TIdentifier>
{
IEnumerable<TModel> ReadCollection(TIdentifier identifier);
}