Using LINQ to perform queries
Rx allow developers to use the IObservable
interface that represents synchronous data streams to write queries using LINQ. To recap, Rx can be thought of as consisting of three sections:
- Observables: The interface that brings together and represents all these data streams
- Language-Integrated Query (LINQ): The ability to use LINQ to query these multiple data streams
- Schedulers: Parametrizing concurrency using schedulers
In this recipe, we will be looking at the LINQ functionality of Rx in more detail.
Getting ready
As observables are just data streams, we can use LINQ to query them. In the following recipe, we will output text to the screen based on a LINQ query.
How to do it…
- Start by adding a new Windows Forms project to your solution:
- Call the project
winformRx
and click on the OK button: - In Toolbox, search for the TextBox control and add it to your form:
- Finally, add a label control to your form:
- Right-click on your
winformRx
project and select Manage NuGet Packages...