Search code examples
c#.netidisposable

Implement IDisposable in derived class


If I have interface (example from apress book) which implements IDisposable like this

public interface IArchitectRepository : IDisposable
{
    IEnumerable<Architect> GetArchitects();
    Architect GetAchitectDetails(int id);
    void Create(Achitect a);
    void Update(Achitect a);
    void Delete(int id);
    void Save();
}

how would I implement Dispose method in derived class?

In book the it's left as NotImplementedException.


Solution

  • There is no reason why you would implement the Dispose pattern any differently than normal.

    See Implementing a Dispose Method