I have following interfaces
public interface IReport<TInput, TOutput>
{
List<TOutput> GenerateReport(TInput input);
}
public interface IReport<TOutput>
{
List<TOutput> GenerateReport();
}
But now I want to have following interface
public interface IReport<TInput, TOutput>
{
TOutput GenerateReport(TInput input);
}
Is it possible to have like this ?
Thanks
No, that’s not possible because you already have an
IReport<TInput, TOutput>interface defined. And you can’t move theTOutput GenerateReport(TInput input);to the first interface because it already provides a method with the same name and same input arguments. The output arguments are not taken into account when doing overloading method resolution.But given the output arguments of your method I would simply use more meaningful names: