Passing Interfaces As Method Arguments

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:

image

This is with no doubt one of the most important features in programming by contracts with interfaces.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.14.243