Can LINQ expression classes implement an observer pattern instead of deferred execution?

We have problems in the state machine application. The application is implemented as a Windows service and is based on iteration (it "projects" itself on everything) and there are many instances processed by the state machine.

Since I'm reading John Skeet’s MEAP version of C # in Depth, 2nd ed, I wonder if I can change all this to use instances of the linq expression to provide protection and conditions using expression trees,

We are creating many applications on this engine with a state computer and are likely to benefit greatly from the new expression tree visualizer in VS 2010

Now, a simple example. If I have an expression tree where there is an OR Expression condition with two auxiliary nodes, is there a way that they can implement the observer pattern so that the expression tree becomes an event? If the condition changes, it should notify the parent node (OR node). Since the OR node then changes from "false" to "true", then it should notify the parent of ITS, etc.

I like the declarative expression tree model, but the deferred execution model works in the opposite direction of the control flow if you want to β€œlive” based on events.

Am I on a wild goose chase? Or is there some kind of concept in BCL that can help me with this?

+4
source share
1 answer

It looks like the new Reactive Framework might interest you:

Rx is a library for compiling asynchronous and event-based programs using observable collections.

+5
source

Source: https://habr.com/ru/post/1306085/


All Articles