What are the major difference between bindable LINQ and continuous LINQ?
•Bindable LINQ: www.codeplex.com/bindablelinq
•Continuous LINQ: www.codeplex.com/cli
I think Bindable LINQ and continuous LINQ are about the same: they provides observing for changes in LINQ computation. Implementation and API provided may some differ. It seems my ObservableComputations library covers functionality expected from Bindable LINQ and continuous LINQ and has no problems mentioned in https://stackoverflow.com/a/174924/2663791. That library works with INotifyPropertyChanged and INotifyCollectionChanged interfaces, that makes it possible to operate with ObservableCollection direcly. Using that library you can code like this:
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using IBCode.ObservableComputations;
namespace ObservableComputationsExamples
{
public class Order : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public int Num {get; set;}
private decimal _price;
public decimal Price
{
get => _price;
set
{
_price = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Price)));
}
}
public Order(int num, decimal price)
{
Num = num;
_price = price;
}
}
class Program
{
static void Main(string[] args)
{
ObservableCollection orders =
new ObservableCollection(new []
{
new Order(1, 15),
new Order(2, 15),
new Order(3, 25),
new Order(4, 27),
new Order(5, 30),
new Order(6, 75),
new Order(7, 80),
});
//********************************************
// We start using ObservableComputations here!
Filtering expensiveOrders = orders.Filtering(o => o.Price > 25);
checkFiltering(orders, expensiveOrders); // Prints "True"
expensiveOrders.CollectionChanged += (sender, eventArgs) =>
{
// see the changes (add, remove, replace, move, reset) here
};
// Start the changing...
orders.Add(new Order(8, 30));
orders.Add(new Order(9, 10));
orders[0].Price = 60;
orders[4].Price = 10;
orders.Move(5, 1);
orders[1] = new Order(10, 17);
checkFiltering(orders, expensiveOrders); // Prints "True"
Console.ReadLine();
}
static void checkFiltering(
ObservableCollection orders,
Filtering expensiveOrders)
{
Console.WriteLine(expensiveOrders.SequenceEqual(
orders.Where(o => o.Price > 25)));
}
}
}
Please, add ObservableComputations library to the list in the question (after Obtics).