Reputation: 2636
Currently I have the following:
interface IMyInterfaceReturnType : IEnumerable<string>, IDisposable
{
}
interface IMyInterface
{
IMyInterfaceReturnType MyInterfaceMethod();
}
Is there a way that I can alter the method signature of MyInterfaceMethod() such that I can express that I will return an object that is both IEnumerable and Disposable without creating an intermediate interface? Say:
interface IMyInterface
{
IEnumerable<string>, IDisposable MyInterfaceMethod();
}
Upvotes: 3
Views: 1036
Reputation: 3619
This can be done with generics:
interface IMyInterface<T> where T :IEnumerable<string>, IDisposable
{
T MyInterfaceMethod();
}
Upvotes: 1