SkillAgentSearch skills...

ObservableComputations

Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces.

Install / Use

/learn @IgorBuchelnikov/ObservableComputations

README

Coverage Status

Nuget package newest version Nuget package downloads number

chat

ObservableComputations

<details> <summary>What I should know to read this guide?</summary> To understand written here you should know basic programming and OOP concepts, C# syntax (including events, extension methods, lambda expressions), <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/">LINQ</a>, <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.8">INotifyPropertyChanged</a>, <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged?view=netframework-4.8">INotifyCollectionChanged</a>, <a href="https://docs.microsoft.com/en-us/dotnet/api/system.idisposable?view=net-5.0">IDisposable</a> interfaces.

It is advisable to know the differences between <a href="https://docs.microsoft.com/en-us/dotnet/api/system.delegate?view=netframework-4.8">delegates</a> and <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees/">expression trees</a>.

To imagine the <a href="#use-cases-and-benefits">benefits of using ObservableComputations</a> you should know about <a href="https://docs.microsoft.com/en-us/dotnet/desktop-wpf/data/data-binding-overview">binding in WPF</a> (or in other UI platforms: <a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/basic-bindings">Xamarin</a>, <a href="https://demos.telerik.com/blazor-ui/grid/observable-data">Blazor</a>), especially in relation to <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.8">INotifyPropertyChanged</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged?view=netframework-4.8">INotifyCollectionChanged</a> interfaces, Entity framework`s <a href="https://docs.microsoft.com/en-us/dotnet/api/system.data.entity.dbset.local?view=entity-framework-6.2.0">DbSet.Local</a> property (<a href="https://docs.microsoft.com/en-us/ef/ef6/querying/local-data">local data</a>), <a href="https://www.entityframeworktutorial.net/entityframework6/async-query-and-save.aspx">asynchronous querying in Entity framework</a>.

</details>

What is ObservableComputations?

This is a cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces. The computations include ones similar to LINQ, the computation of arbitrary expression and additional features. The computations are implemented as extension methods, like LINQ ones. You can combine calls of ObservableComputations extension methods including chaining and nesting, as you do for LINQ methods. Computations in background threads, including parallel ones, as well as time-related processing of CollectionChanged and PropertyChanged events, are supported.

Why ObservableComputations?

ObservableComputations is easy to use and powerful implementation of reactive programming paradigm. With ObservableComputations, your code will fit more to the functional (declarative) style than with standard LINQ. Reactive programming in the functional style makes your code clearer, shorter, more reliable, and more performant. With reactive programming, you can develop rich UI faster. See details in Use cases and benefits section.

Demo applications

Analogs

The closest analogs of ObservableComputations are the following libraries: Obtics, OLinq, NFM.Expressions, BindableLinq, ContinuousLinq.

Reactive Extensions

<details> <summary>Details</summary> ObservableComputations is not analog of <a href="https://github.com/dotnet/reactive">Reactive Extensions</a>. The main distinguish ObservableComputations from <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> is the following:
  • <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> is abstracted from event specific and event semantics: it is a framework for processing all possible events. <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> handles all events in the same way and all specifics are only in user code. ObservableComputations is focused on <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged.collectionchanged?view=netframework-4.8">CollectionChanged</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged.propertychanged?view=netframework-4.8">PropertyChanged</a> events only and brings great benefit processing these events.
  • <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> library provides a stream of events. ObservableComputations library provides not only the stream of data change events but a currently computed data.

Some of the tasks that you solved using <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> are now easier and more efficient to solve using ObservableComputations. You can use ObservableComputations separately or in cooperation with <a href="https://github.com/dotnet/reactive">Reactive Extensions</a>. Observable Computations will not replace <a href="https://github.com/dotnet/reactive">Reactive Extensions</a>:

  • when time-related processing of events (Throttle, Buffer) needed. ObservableComputations allow you to implement time-related handling of <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged.collectionchanged?view=netframework-4.8">CollectionChanged</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged.propertychanged?view=netframework-4.8">PropertyChanged</a> events by cooperation with <a href="https://github.com/dotnet/reactive">Reactive Extensions</a> (see the example <a href="#variants-of-implementation-of-iocdispatcher-interface">here</a>);
  • when processing events not related to data (for example, keystrokes), especially when combining these events.
  • when working with asynchronous operations (<a href="https://docs.microsoft.com/en-us/previous-versions/dotnet/reactive-extensions/hh229052(v%3Dvs.103)">Observable.FromAsyncPattern method</a>).
</details>

ReactiveUI and DynamicData

<details> <summary>Details</summary> The <a href="https://github.com/reactiveui/ReactiveUI">ReactiveUI</a> library (and its <a href="https://github.com/reactiveui/DynamicData">DynamicData</a> sub-library) are not abstracted from the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged?view=netframework-4.8">INotifyPropertyChanged</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged?view=netframework-4.8">INotifyCollectionChanged</a> interfaces and when working with these interfaces allows you to do much the same things as ObservableComputations, but ObservableComputations are less verbose, easier to use, more declarative, less touches the source data. Why?
  • Reactivity of ObservableComputations is based on two events only: <a href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized.inotifycollectionchanged.collectionchanged?view=netframework-4.8">CollectionChanged</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged.propertychanged?view=netframework-4.8">PropertyChanged</a>. This reactivity is native to ObservableComputations. Reactivity of <a href="https://github.com/reactiveui/ReactiveUI">ReactiveUI</a> is based on interfaces inherited from <a href="https://github.com/dotnet/reactive">Reactive Exten
View on GitHub
GitHub Stars118
CategoryDevelopment
Updated4mo ago
Forks9

Languages

C#

Security Score

97/100

Audited on Oct 28, 2025

No findings