Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 21, 2026·3 min de lecture

Rx.NET — Reactive Extensions for .NET

Rx.NET (System.Reactive) brings the observer pattern and LINQ-style query operators to asynchronous and event-based data streams in .NET, enabling composable and declarative async programming.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Rx.NET
Commande d'installation directe
npx -y tokrepo@latest install 40fde89a-8500-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Rx.NET is the .NET implementation of Reactive Extensions, a library for composing asynchronous and event-based programs using observable sequences. It provides a rich set of LINQ operators to filter, project, aggregate, and combine streams of data, making complex async workflows easier to reason about and maintain.

What Rx.NET Does

  • Models push-based data streams with IObservable<T> and IObserver<T>
  • Provides 100+ LINQ-style operators for stream composition (Select, Where, Merge, Zip, Buffer, etc.)
  • Manages concurrency and scheduling through pluggable schedulers
  • Bridges events, tasks, and async enumerables into observable sequences
  • Supports backpressure handling and error recovery operators

Architecture Overview

Rx.NET is built around the IObservable<T> / IObserver<T> duality to IEnumerable<T> / IEnumerator<T>. Operators are implemented as extension methods that compose observable pipelines lazily. Schedulers abstract threading and timing, allowing the same pipeline to run on thread pools, UI dispatchers, or test schedulers. The library ships as several NuGet packages: System.Reactive (core), System.Reactive.Linq (operators), and platform-specific bindings.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package System.Reactive
  • Targets .NET Standard 2.0, compatible with .NET Framework 4.7+, .NET 6-9
  • No external services or configuration files needed
  • Choose schedulers for concurrency: TaskPoolScheduler, CurrentThreadScheduler, DispatcherScheduler
  • Add System.Reactive.Testing for unit-testing time-dependent streams with TestScheduler

Key Features

  • Declarative composition of async event streams with LINQ syntax
  • Hot and cold observable support for flexible subscription models
  • Built-in error handling operators: Retry, Catch, OnErrorResumeNext
  • Time-based operators: Throttle, Debounce, Sample, Delay, Timeout
  • Subjects for multicasting and bridging imperative and reactive code

Comparison with Similar Tools

  • async/await + IAsyncEnumerable — pull-based; Rx.NET is push-based with richer temporal operators
  • System.Threading.Channels — bounded producer-consumer; no built-in composition operators
  • MediatR — in-process request/response mediator; Rx.NET handles continuous data streams
  • TPL Dataflow — block-based pipeline; Rx.NET has more composable operator vocabulary
  • Akka.NET Streams — actor-based streaming; heavier runtime, built-in backpressure

FAQ

Q: When should I use Rx.NET instead of async/await? A: Use Rx.NET when you need to compose multiple event sources, apply time-based operators, or process continuous streams. For single async operations, async/await is simpler.

Q: Does Rx.NET work with Blazor and MAUI? A: Yes. The core System.Reactive package targets .NET Standard 2.0 and runs on all modern .NET platforms.

Q: How do I test time-dependent Rx.NET code? A: Use TestScheduler from System.Reactive.Testing to advance virtual time and assert on emitted values deterministically.

Q: Is Rx.NET still maintained? A: Yes. The project moved under the dotnet organization on GitHub and continues to receive updates and community contributions.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires