Default Implementations Coming to Interfaces With C# 8

See the original posting on DZone Python

C# 8.0 will introduce new language feature — default implementations of interface members. This means that we can define a body-to-interface member and implementing class that doesn’t implement the given interface member and will use the default one from interface itself. Here’s my deep-dive and analysis of default implementions of interfaces.

Default Implementations of Interface Members

Let’s start with a classic example based on Mads Torgersen’s blog post, Default implementations in interfaces, and take a look at this famous logger example. Let there be an interface for a logger.