Leveraging the interface, collection, and object

Not only can classes and types apply an extension method, but interfaces, collections, and any other objects can be functionally extended using an extension method as well. We are going to discuss this in the upcoming sections.

Extending the interface

We can extend the method in an interface in the same way we extend the method in a class or type. We still need the public static class and the public static method. By extending the interface abilities, we can use the extension method just after we create it without the need to create the implementation inside the class that we inherit from the interface, since the implementation is done when we declare the extension method. Let's take a look at the ...

Get Functional 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.