Skip to content

C# Feature - Default interface methods

Default interface methods allow interfaces to provide method bodies, which helps evolve contracts without breaking every implementation.

C# 8.0 (2019)

public interface ILogger
{
void Log(string message);
}
public interface ILogger
{
void Log(string message);
void LogError(string message) => Log($"ERROR: {message}");
}
  • Use this for interface evolution, not as a replacement for good abstraction design.
  • Keep default implementations small and unsurprising.