Case Study: INotifyProperty Interfaces and UI Programming

The .NET Framework’s Base Class Library (BCL) comes with two interfaces that can be used to keep track of changes to property values. Because an interface is the contract between two parties, we should ask ourselves what those parties are and why they would care. A typical example use case for those interfaces is in data binding scenarios for UI or web programming: As soon as a property changes on the bound object, the display needs to update to reflect the underlying change. In this particular case, the UI framework (for example, WPF) consumes the interface and provides auto-update services for objects that are bound to some control. To make this work, an object needs to notify the UI ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.