I have an interface as follows:
public interface ISelectEntity
{
List<T> GetFromDB<T, O>(O data);
}
I’m implementing it as follows within a StatusCodes class
List<StatusCodes> ISelectEntity.GetFromDB<StatusCodes, StatusCodesInputParameters>(StatusCodesInputParameters data)
{
return EntitiesClass.PopulateStatusCodes(EntitiesDAL.GetStatusCodes(data));
}
I’m receiving the following error, however:
Error 2 Argument ‘1’: cannot convert from ‘StatusCodesInputParameters’ to ‘Namespace.StatusCodesInputParameters’
Assuming that my namespace is called Namespace, that’s the error I receive. All of this is within this one namespace. What am I doing wrong?
You cannot change method signatures in derived classes. You could define the generic argument on the interface though instead of doing it on the method:
and a sample explicit implementation might look like this:
and a sample implicit implementation: