Extension Methods

  • Trey Nash

Abstract

Using extension methods, you can declare methods that appear to augment the public interface, or contract, of a type. At first glance, they may appear to provide a way to extend classes that are not meant to be extended. However, it’s very important to note that extension methods cannot break encapsulation. That’s because they’re not really instance methods at all and thus cannot crack the shell of encapsulation on the type they are extending.

Keywords

Sugar Encapsulation Prefix 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 5.
    Design Patterns: Elements of Reusable Object-Oriented Software, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (Boston, MA: Addison-Wesley Professional, 1995), is cited in the references at the end of this book.Google Scholar

Copyright information

© Trey Nash 2010

Authors and Affiliations

  • Trey Nash

There are no affiliations available

Personalised recommendations