C# 8 brings new features to interfaces, including default implementation, access modifiers, and static members. We'll look at these new features, and see where they are useful and where they should be avoided. The world of interfaces has changed; the line between interfaces and abstract classes has blurred; and C# now has multiple inheritance. With some practical tips, "gotchas", and plenty of examples, we'll see how to use these features effectively (and safely) in our code.
This repository contains slides and code samples for a live presentation. Details of the various topics can be found in the accompanying articles.
Presentation Recordings:
- Tulsa .NET User Group - Recorded Jul 23, 2020
- Southeast Valley .NET User Group & North West Valley .NET User Group - Recorded Jun 24, 2020
Articles:
- Abstract Classes vs. Interfaces in C# - What You Know is Probably Wrong
- A Closer Look at C# 8 Interfaces
- Properties and Default Implementation
- Dangerous Assumptions in Default Implementation
- "dynamic" and Default Implementation
- Unit Testing Default Implementation
- Public, Private, and Protected Members
- Static Members
- Static Main -- Why Not?
Microsoft Docs Samples
- Tutorial: Update interfaces with default interface methods in C# 8.0
- Tutorial: Mix functionality in when creating classes using interfaces with default interface methods
Additional Topics
- IEnumerable, ISaveable, IDontGetIt: Understanding C# Interfaces
- Explicit Interface Implementation
- Updating an Interface Implementation (prior to C# 8)
- Misusing C#: Multiple Main() Methods
- -main (C# Compiler Options) (how to specify the entry point if you have multiple "static Main()" methods in an application)