I come across a lot of situations where I have declared a generic interface and later I needed a non-generic version of this interface, or at least non-generic version of some of the methods or properties on that interface.
I would usually declare a new non-generic interface and have it inherit the generic interface.
The problem I am running into in shows in the example below:
public abstract class FormatBase { }
public interface IBook<F> where F : FormatBase
{
F GetFormat();
}
public interface IBook
{
object GetFormat();
}
public abstract class BookBase : IBook<FormatBase>, IBook
{
public abstract FormatBase GetFormat();
object IBook.GetFormat()
{
return GetFormat();
}
}
Since the only way to declare the IBook (non-generic) interface is explicitly, how do you guys go about making it abstract?
Why you can’t write implementation of explicit interface, instead of declaring it abstract?