One of the most powerful features when working with interfaces is that methods can receive interfaces as parameters. This means that you can pass in any object as these parameters so long as it implements the given interface. The following example shows a method that accepts an argument of type IList
, meaning that any object implementing the IList
interface can be accepted:
This is with no doubt one of the most important features in programming by contracts with interfaces.
3.19.14.243