Chapter 5. Get this instead: intercepting locations

This chapter covers

  • What is a location?
  • Using PostSharp to intercept locations
  • Writing lazy-loading aspects
  • How noisy INotifyPropertyChanged makes your code
  • Using AOP to make INotifyPropertyChanged clean and easy

In chapter 3, I wrote about method interception. In this chapter, we’ll look at a different kind of interception: the interception of locations. I’ll start by reviewing what a location is (field or property), then I’ll show you a couple of examples of real-world aspects that you can use on locations. So far, the focus has been mainly on methods. But locations are an important part of your code and can be susceptible to the same types of repetitive boilerplate as methods.

Get AOP in .NET 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.