C# › Interfaces & Abstract Classes

What is the Interface Segregation Principle and how does it apply in C#?

Advanced

Answer

Clients should not depend on methods they do not use; prefer several small, focused interfaces over one large one, so implementers and consumers stay decoupled.
// instead of IRepository with 20 methods:
interface IReadRepository<T> { Task<T?> GetAsync(int id); }
Real-world example Splitting a fat service interface so a read-only consumer needn't depend on write methods.