Please consider the following interfaces:
interface IFile
{
// Members
};
interface IAudioFile : IFile
{
// Members
};
interface IVideoFile : IFile
{
// Members
};
enum ContentType
{
Audio,
Video
};
interface IProvider
{
HashSet<ContentType> GetSupportedTypes();
IList<IFile> GetFiles(ContentType contentType);
};
I think that ContentType enumeration is redundant. Is there any way to use something like interface identifier instead of enumeration type?
Any comments on the interface design are very appreciated.
It really depends on what you're trying to accomplish, but I one options you may want to look at is using generics, so that IProvider is as so
which can be implemented like so
and called like so