Inheriting and overriding interfaces in C#

Posted by Daniel A. White on Stack Overflow See other posts from Stack Overflow or by Daniel A. White
Published on 2010-04-30T17:23:25Z Indexed on 2010/04/30 17:27 UTC
Read the original article Hit count: 169

Filed under:
|

Please note: I am writing this question.

I have these interfaces in a library/framework I am working on:

interface IRepository<TKey,TModel> { 
    void Remove(TModel entity);
}

interface IRepository<T> : IRepository<int, T> { }

interface ISoftDeleteRepository<TKey,TModel> : IRepository<TKey, TModel> { }

interface ISoftDeleteRepository<TModel> 
    : ISoftDeleteRepository<int, TModel>, IRepository<TModel> { }

and these implementations

class Repository : IRepository { void Remove(TModel entity) { // actually Delete } }

interface IRepository<T> : IRepository<int, T> { }

interface ISoftDeleteRepository<TKey,TModel> : IRepository<TKey, TModel> { }

interface ISoftDeleteRepository<TModel> 
    : ISoftDeleteRepository<int, TModel>, IRepository<TModel> { }

© Stack Overflow or respective owner

Related posts about c#

Related posts about oop