Open sandboxFocus

Class ObservedExpressionsAttribute

Attribute generated by the ObservableAttribute aspect on OnChildPropertyChanged and OnObservablePropertyChanged methods, indicating which property expressions are observed by these methods.

Inheritance
ObservedExpressionsAttribute
Namespace: Metalama.Patterns.Observability
Assembly: Metalama.Patterns.Observability.dll
Syntax
[AttributeUsage(AttributeTargets.Method)]
public sealed class ObservedExpressionsAttribute : Attribute
Remarks

This attribute forms a contract between base types and derived types in class hierarchies. It informs derived types about which properties the base class monitors for changes, allowing derived classes to efficiently add their own change handling logic.

The OnChildPropertyChanged method is called when a property of a child object (i.e., an object stored in a field or property of the current type) has changed. The OnObservablePropertyChanged method is called when a property implementing INotifyPropertyChanged has changed, providing both the old and new values to allow derived classes to subscribe and unsubscribe from change events.

Constructors

Name Description
ObservedExpressionsAttribute(params string[])

Initializes a new instance of the ObservedExpressionsAttribute class.

Extension Methods

See Also