Section 6: Lab: Polymorphism
- The principle of polymorphism, or many forms
- Method overloading and operator overloading
- virtual, override and how they differ from hiding with new
- Check an object's type with pattern matching
- Lab: calculate several kinds of shipping cost through one method
Section 7: Lab: sealed and abstract Classes
- Why sealed classes and sealed methods matter
- How abstract classes and abstract methods differ from ordinary classes
- A template of steps with an abstract class
- Lab: a payment system that forces every channel to follow the same steps
Section 8: Lab: Interfaces
- Using interfaces, and the difference between abstract classes and interfaces
- Implementing several interfaces and explicit implementation
- Default interface methods and static abstract members
- Standard .NET interfaces: IComparable, IEquatable and IDisposable
- Lab: sort and compare objects through interfaces
Section 9: Lab: Generics, Delegates, Events and Extension Members
- Generic classes and methods with constraints
- Delegates, Func, Action and lambdas
- Declare and use events to signal changes
- Extend existing types with C# 14 extension members
- Lab: a generic repository that raises an event when data changes
Section 10: Lab: SOLID Principles and Dependency Injection
- The single responsibility and open/closed principles
- Liskov substitution, interface segregation and dependency inversion
- Dependency injection with Microsoft.Extensions.DependencyInjection
- Singleton, scoped and transient lifetimes
- Lab: refactor tightly coupled code so that it can be tested with DI