A C# .NET Library to simplify M-V-VM (Model, View, Viewmodel) programming. Includes base implementations for observable objects (property change notifications), weak delegates/events and asynchronous and synchronized events, efficient event handling, disposable base, etc.
Sharp Observation fulfills the following goals:
- Provides a base implementation of the observable pattern, including:
- INotifyPropertyChanged and INotifyPropertyChanging implementation.
- A richer PropertyChangedEventArgs which enable undo scenarios.
- A bypass mechanism to property change optimize performance when no listeners are attached.
- An IsNotifcationActive property which expresses whether any listeners are attached.
- An IsNotifcationActiveChanged event which fires when IsNotifcationActive changes.
- A helper type to simplified implementation of CLR properties.
Read more about observable objects
- Extension methods to convert delegates to become:
- Weak referencing - i.e. the delegate does not keep it's target alive.
- Synchronized - i.e. the delegate raises it's target on an appropriate thread
- Asynchronous - i.e. the delegate does not wait for the target to complete before returning.
How to use Weak Delegates
How Weak Delegates Are Implemented
How to use synchronized events
How to use asynchronous eventsUsing Asynchronous Events
- Provides a base implementation of the disposable pattern, including:
- a DisposedEvent to enable decoupling patterns in response to the disposal.
- an IsDisposed property, allowing blind callers to detect whether the instance has been disposed.
- Provides a base implementation for types which expose events
- A performance optimized version of EventHandlerList is implemented, reducing memory footprint of event objects.
- Type safe / signature safe pattern for raising events.
Read more about implementing efficient event-raising classes