I have an interface and I want to create a list of Repositories using generics. However, the T
next to IRepository
has The type or namespace T could not be found
. How can I create a property that is a list of generic repositories?
public interface IDataAccess
{
IUnitOfWork UnitOfWork { get; set; }
IEnumerable<IRepository<T>> Repositories { get; set; }
You would need to specify IDataAccess<T>
in order for the T type information to be propagated down to the Repositories
property. Otherwise, the compiler has no way to determine what the type is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.