12
Go Beyond Inheritance
With object-oriented languages such as C#, we can derive our types from other types and we can also implement contracts (interfaces) and make them fulfill that contract. Implementing interfaces and making an implementation fulfill these is really one of the great things about a type-safe language. With the compiler, we get everything checked to make sure we implement the contract, while at runtime, we can leverage the interface type to be a representation rather than having to know the actual implementor.
Sometimes, however, the verbosity of having to implement an interface can be too much. It can also be limited to what you’re trying to achieve.
In this chapter, we will cover the following topics:
- Method signature ...
Get Metaprogramming in C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.