I have a generic interface and I want to constrain types that this generic parameter can accept. Here is the interface:
public interface IBaseRequestRepository<T> where T : IRequestPackage, IRequestDynamicPackage, IRequestHotelOnly, IRequestFlightOnly { IList GetByOccupancyAndTravelDate(int occupancyId, int travelBegYear, int travelBegDate, int travelEndYear, int travelEndDate); } But this gives an error:
Error 1 The type 'IRequestPackage' cannot be used as type parameter 'T' in the generic type or method 'IBaseRequestRepository'. There is no implicit reference conversion from 'IRequestPackage' to 'IRequestFlightOnly'.
Any suggestions?