• Stars
    star
    6,687
  • Rank 5,913 (Top 0.2 %)
  • Language
    C#
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Reactive Extensions for .NET

Reactive Extensions

This repository contains four libraries which are conceptually related in that they are all concerned with LINQ over sequences of things:

Each will be described later in this README.

FREE Introduction to Rx.NET 2nd Edition eBook

Introduction to Rx.NET 2nd Edition book cover.

Reactive programming provides clarity when our code needs to respond to events. The Rx.NET libraries were designed to enable cloud-native applications to process live data in reliable, predictable ways.

We've written a FREE book which explains the vital abstractions that underpin Rx, and shows how to exploit the powerful and extensive functionality built into the Rx.NET libraries.

Based on Lee Campbell's 2010 book (kindly donated to the project), it has been re-written to bring it up to date with Rx.NET v6.0, .NET 8.0, and modern cloud native use cases such as IoT and real-time stream data processing.

Introduction to Rx.NET is available Online, on GitHub, as PDF, and EPUB.


Getting the bits

Channel Rx AsyncRx Ix System.Linq.Async
NuGet.org # # # #
NuGet.org preview (if newer than release) # # # #
Build Build Status Build Status Build Status Built as part of Ix
Azure
Artifacts
System.Reactive package in RxNet feed in Azure Artifacts System.Reactive.Async package in RxNet feed in Azure Artifacts System.Interactive package in RxNet feed in Azure Artifacts System.Linq.Async package in RxNet feed in Azure Artifacts
Release history ReleaseHistory ReleaseHistory ReleaseHistory

For nightly builds, configure NuGet to use this feed: https://pkgs.dev.azure.com/dotnet/Rx.NET/_packaging/RxNet/nuget/v3/index.json

Join the conversation

Catch us in the #rxnet channel over at https://reactivex.slack.com/

A Brief Introduction to Rx

In this digital age, live data streams are ubiquitous. Financial applications depend on a swift response to timely information. Computer networks have always been able to provide extensive information about their health and operation. Utility companies such as water providers have vast numbers of devices monitoring their operations. User interface and game building frameworks report user interactions in great detail. Delivery vans continuously report their progress. Aircraft provide performance telemetry to detect potential maintenance issues before they become serious problems, and cars are now starting to do the same. Many of us wear or carry devices that track our physical activity and even vital signs. And the improvements in machine learning have enriched the insights that can be derived from the ever-increasing volume and variety of live data.

But despite being so widespread, live information streams have always been something of a second class citizen. Almost all programming languages have some innate way to work with lists of data (e.g., arrays), but these mechanisms tend to presume that the relevant data is already sitting in memory, ready for us to work with it. What's missing is the liveness—the fact that an information source might produce new data at any moment, on its own schedule.

Rx elevates the support for live streams of information to the same level as we expect for things like arrays. Here's an example:

var bigTrades =
    from trade in trades
    where trade.Volume > 1_000_000;

This uses C#'s LINQ feature to filter trades down to those entities with a volume greater than one million. This query expression syntax is just a shorthand for method calls, so we could also write it this way:

var bigTrades = trades.Where(trade => trade.Volume > 1_000_000);

The exact behaviour of these two (equivalent) code snippets depends on what type trades has. If it were a IEnumerable<Trade>, then this query would just iterate through the list, and bigTrades would be an enumerable sequence containing just the matching objects. If trades were an object representing a database table (e.g., an Entity Framework DbSet, this would be translated into a database query. But if we're using Rx, trades would be an IObservable<Trade>, an object reporting live events as they happen. And bigTrades would also be an IObservable<Trade>, reporting only those trades with a volume over a million. We can provide Rx with a callback to be invoked each time an observable source has something for us:

bigTrades.Subscribe(t => Console.WriteLine($"{t.Symbol}: trade with volume {t.Volume}"));

The two key features of Rx are:

  • a clearly defined way to represent and handle live sequences of data (IObservable<T>)
  • a set of operators (such as the Where operator just shown) enabling event processing logic to be expressed declaratively

Rx has been particularly successfully applied in user interfaces. (This is also true outside of .NET—RxJS is a JavaScript spin-off of Rx, and it is very popular in user interface code.) The https://github.com/reactiveui/reactiveui makes deep use of Rx to support .NET UI development.

Ian Griffiths presented a concise 60 minute overview of Reactive Extensions for .NET at the dotnetsheff meetup in 2020. More videos are available on the Rx playlist.

AsyncRx.Net

Although Rx is a natural way to model asynchronous processes, its original design presumed that code acting on notifications would run synchronously. This is because Rx's design predates C#'s async/await language features. So although Rx offer adapters that can convert between IObservable<T> and Task<T>, there were certain cases where async was not an option.

AsyncRx.Net lifts this restriction by defining IAsyncObservable<T>. This enables observers to use asynchronous code. For example, if bigTrades were an IAsyncObservable<Trade> we could write this:

bigTrades.Subscribe(async t => await bigTradeStore.LogTradeAsync(t));

AsyncRx.Net is currently in preview.

Interactive Extensions

Rx defines all the standard LINQ operators available for other providers, but it also adds numerous additional operators. For example, it defines Scan, which performs the same basic processing as the standard Aggregate operator, but instead of producing a single result after processing every element, it produces a sequence containing the aggregated value after every single step. (For example, if the operation being aggregated is addition, Aggregate would return the sum total as a single output, whereas Scan would produce a running total for each input. Given a sequence [1,2,3], Aggregate((a, x) => a + x) produces just 6, whereas Scan would produce [1,3,6].)

Some of the additional operators Rx defines are useful only when you're working with events. But some are applicable to sequences of any kind. So the Interactive Extensions (Ix for short) define implementations for IEnumerable<T>. Ix is effectively an extension of LINQ to Objects, adding numerous additional operators. (Its usefulness is borne out by the fact that the .NET runtime libraries have, over time, added some of the operators that used to be available only in Ix. For example, .NET 6 added MinBy and MaxBy, operators previously only defined by Ix.)

This library is called the "Interactive Extensions" because "Interactive" is in a sense the opposite of "Reactive". (The name does not refer to user interactions.)

LINQ for IAsyncEnumerable (System.Linq.Async)

One of the features pioneered by Ix was an asynchronous version of IEnumerable<T>. This is another example of a feature so useful that it was eventually added to the .NET runtime libraries: .NET Core 3.0 introduced IAsyncEnumerable<T>, and the associated version C# (8.0) added intrinsic support for this interface with its await foreach construct.

Although .NET Core 3.0 defined IAsyncEnumerable<T>, it did not add any corresponding LINQ implementation. Whereas IEnumerable<T> supports all the standard operators such as Where, GroupBy, and SelectMany, .NET does not have built-in implementations of any of these for IAsyncEnumerable<T>. However, Ix had provided LINQ operators for its prototype version of IAsyncEnumerable<T> from the start, so when .NET Core 3.0 shipped, it was a relatively straightforward task to update all those existing LINQ operators to work with the new, official IAsyncEnumerable<T>.

Thus, the System.Linq.Async NuGet package was created, providing a LINQ to Objects implementation for IAsyncEnumerable<T> to match the one already built into .NET for IEnumerable<T>.

Since all of the relevant code was already part of the Ix project (with IAsyncEnumerable<T> also originally having been defined by this project), the System.Linq.Async NuGet package is built as part of the Ix project.

Contributing

Some of the best ways to contribute are to try things out, file bugs, and join in design conversations.

Looking for something to work on? The list of up for grabs issues is a great place to start.

This project has adopted a code of conduct adapted from the Contributor Covenant to clarify expected behavior in our community. This code of conduct has been adopted by many other projects. For more information see the Code of conduct.

.NET Foundation

This project is part of the .NET Foundation along with other projects like the .NET Runtime. The .NET Foundation provides this project with DevOps infrastructure to compile, test, sign and package this complex solution which has over 100 million downloads. It also provides conservatorship enabling the project to pass from maintainer to maintainer, enabling continuity for the community.

Current Core Team

The people currently maintaining Rx are:


Ian Griffiths

Hove, UK

Ian's blog on endjin.com


Howard van Rooijen

Winchester, UK

Howard's blog on endjin.com

Rx has been around for roughly a decade and a half, so we owe a great deal to its creators, and the many people who have worked on it since. See the AUTHORS.txt for a full list.

Roadmap

As part of .NET Conf 2023, Ian Griffiths provided an update on the efforts to modernize Rx.NET for v6.0 and the plans to for v7.0.

For more information, see the following discussions:

We have set out a roadmap explaining our medium term plans for ongoing development of Rx. This diagram illustrates our view of the platforms on which Rx is used, and the planned support lifecycles for these various targets:

The support lifecycle for various .NET platforms, represented as a set of timelines, showing the published plans for widely used versions that are current as of 2023, with a particular focus on which versions will be current as of November 2023. The top section of the diagram shows .NET releases starting with .NET 6.0 being released in November 2021, and shows for each subsequent release occurring in November of each subsequent year, up as far as .NET 13.0 in November 2028. It also shows that even-numbered releases are Long Term Support (LTS for short) releases, supported for 3 years, while odd-numbered releases are supported only for 18 months. The section beneath this shows that .NET Framework versions 4.7.2, 4.8.0, and 4.8.1 will all be in support as of November 2023, and will continue to be in support beyond the timescale covered by this diagram, i.e., beyond November 2028. The section beneath this shows the release plan for MAUI, starting with version 8.0 on November 2023, and subsequent releases at the same time each subsequent year, up to version 13.0 in November 2028. The diagram shows that each of these versions is supported for only 18 months. Beneath this is are two lines showing Xamarin iOS 16.0, and Xamarin Android 13.0 support being active on November 2023, and running for 18 months. Beneath this is a line showing UWP version 10.0.16299 support being active on November 2023, and running beyond the timescale covered by the diagram. Beneath this is a section showing that Unity 2021 was released in 2021, and will go out of support near the end of 2023, and it shows a Unity 2022 release labelled as "Release soon," with a release date somewhere in the middle of 2023. The bottom of the diagram shows the endjin logo, and endjin's corporate motto: "we help small teams achieve big things."

More Repositories

1

aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
C#
33,217
star
2

maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
C#
21,888
star
3

core

.NET news, announcements, release notes, and more!
PowerShell
20,805
star
4

roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
C#
18,994
star
5

corefx

This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime
17,793
star
6

runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
C#
15,172
star
7

coreclr

CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-level classes.
12,807
star
8

efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
C#
12,774
star
9

AspNetCore.Docs

Documentation for ASP.NET Core
C#
12,619
star
10

csharplang

The official repo for the design of the C# programming language
C#
11,300
star
11

BenchmarkDotNet

Powerful .NET library for benchmarking
C#
10,347
star
12

orleans

Cloud Native application framework for .NET
C#
9,460
star
13

blazor

Blazor moved to https://github.com/dotnet/aspnetcore
PowerShell
9,348
star
14

machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
C#
8,456
star
15

wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
C#
6,346
star
16

tye

Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
C#
5,290
star
17

msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
C#
5,215
star
18

MQTTnet

MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
C#
4,466
star
19

winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
C#
4,402
star
20

docs

This repository contains .NET Documentation.
4,246
star
21

Silk.NET

The high-speed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.
C#
4,118
star
22

machinelearning-samples

Samples for ML.NET, an open source and cross-platform machine learning framework for .NET.
PowerShell
4,061
star
23

dotnet-docker

Docker images for .NET and the .NET Tools.
Dockerfile
4,033
star
24

Open-XML-SDK

Open XML SDK by Microsoft
C#
4,014
star
25

fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
F#
3,892
star
26

docfx

Static site generator for .NET API documentation.
C#
3,663
star
27

cli

The .NET Core command-line (CLI) tools, used for building .NET Core apps and libraries through your development flow (compiling, NuGet package management, running, testing, ...).
3,488
star
28

command-line-api

Command line parsing, invocation, and rendering of terminal output.
C#
3,095
star
29

roslynator

Roslynator is a set of code analysis tools for C#, powered by Roslyn.
C#
3,067
star
30

standard

This repo is building the .NET Standard
3,067
star
31

aspnet-api-versioning

Provides a set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
C#
3,027
star
32

corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
C#
2,908
star
33

samples

Sample code referenced by the .NET documentation
C#
2,896
star
34

try

Try .NET provides developers and content authors with tools to create interactive experiences.
TypeScript
2,884
star
35

interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
C#
2,879
star
36

vscode-csharp

Official C# support for Visual Studio Code
TypeScript
2,852
star
37

sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
C#
2,516
star
38

extensions

This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
C#
2,361
star
39

Docker.DotNet

🐳 .NET (C#) Client Library for Docker API
C#
2,242
star
40

maui-samples

Samples for .NET Multi-Platform App UI (.NET MAUI)
C#
2,219
star
41

pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
C#
2,115
star
42

spark

.NET for Apache® Spark™ makes Apache Spark™ easily accessible to .NET developers.
C#
2,018
star
43

iot

This repo includes .NET Core implementations for various IoT boards, chips, displays and PCBs.
C#
1,932
star
44

android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
C#
1,897
star
45

format

Home for the dotnet-format command
C#
1,736
star
46

wcf

This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.
C#
1,693
star
47

Comet

Comet is an MVU UIToolkit written in C#
C#
1,654
star
48

dotNext

Next generation API for .NET
C#
1,597
star
49

templating

This repo contains the Template Engine which is used by dotnet new
C#
1,594
star
50

roslyn-analyzers

C#
1,577
star
51

llilc

This repo contains LLILC, an LLVM based compiler for .NET Core. It includes a set of cross-platform .NET code generation tools that enables compilation of MSIL byte code to LLVM supported platforms.
C++
1,512
star
52

infer

Infer.NET is a framework for running Bayesian inference in graphical models
C#
1,500
star
53

EntityFramework.Docs

Documentation for Entity Framework Core and Entity Framework 6
PowerShell
1,477
star
54

corefxlab

This repo is for experimentation and exploring new ideas that may or may not make it into the main corefx repo.
C#
1,463
star
55

ef6

This is the codebase for Entity Framework 6 (previously maintained at https://entityframework.codeplex.com). Entity Framework Core is maintained at https://github.com/dotnet/efcore.
C#
1,400
star
56

ResXResourceManager

Manage localization of all ResX-Based resources in one central place.
C#
1,311
star
57

announcements

Subscribe to this repo to be notified of Announcements and changes in .NET Core.
1,263
star
58

installer

.NET SDK Installer
C#
1,261
star
59

codeformatter

Tool that uses Roslyn to automatically rewrite the source to follow our coding styles
C#
1,235
star
60

Nerdbank.GitVersioning

Stamp your assemblies, packages and more with a unique version generated from a single, simple version.json file and include git commit IDs for non-official builds.
C#
1,223
star
61

MobileBlazorBindings

Experimental Mobile Blazor Bindings - Build native and hybrid mobile apps with Blazor
C#
1,203
star
62

runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
1,181
star
63

ILMerge

ILMerge is a static linker for .NET Assemblies.
C#
1,175
star
64

try-convert

Helping .NET developers port their projects to .NET Core!
C#
1,146
star
65

sourcelink

Source Link enables a great source debugging experience for your users, by adding source control metadata to your built assets
C#
1,136
star
66

diagnostics

This repository contains the source code for various .NET Core runtime diagnostic tools and documents.
C++
1,092
star
67

upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
C#
982
star
68

project-system

The .NET Project System for Visual Studio
C#
967
star
69

try-samples

C#
920
star
70

ClangSharp

Clang bindings for .NET written in C#
C#
905
star
71

TorchSharp

A .NET library that provides access to the library that powers PyTorch.
C#
891
star
72

designs

This repo is used for reviewing new .NET designs.
C#
843
star
73

LLVMSharp

LLVM bindings for .NET Standard written in C# using ClangSharp
C#
837
star
74

crank

Benchmarking infrastructure for applications
C#
819
star
75

DataGridExtensions

Modular extensions for the WPF DataGrid control
C#
805
star
76

SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
C#
728
star
77

intro-to-dotnet-web-dev

Get Started as a Web Developer with .NET, C#, and ASP.NET Core
C#
690
star
78

arcade

Tools that provide common build infrastructure for multiple .NET Foundation projects.
C#
664
star
79

Microsoft.Maui.Graphics

An experimental cross-platform native graphics library.
C#
657
star
80

HttpRepl

The HTTP Read-Eval-Print Loop (REPL) is a lightweight, cross-platform command-line tool that's supported everywhere .NET Core is supported and is used for making HTTP requests to test ASP.NET Core web APIs and view their results.
C#
651
star
81

csharp-notebooks

Get started learning C# with C# notebooks powered by .NET Interactive and VS Code.
Jupyter Notebook
629
star
82

performance

This repo contains benchmarks used for testing the performance of all .NET Runtimes
F#
620
star
83

cli-lab

A guided tool will be provided to enable the controlled clean up of a system such that only the desired versions of the Runtime and SDKs remain.
C#
609
star
84

Microsoft.Maui.Graphics.Controls

Experimental Microsoft.Maui.Graphics.Controls - Build drawn controls (Cupertino, Fluent and Material)
C#
608
star
85

Scaffolding

Code generators to speed up development.
C#
596
star
86

csharpstandard

Working space for ECMA-TC49-TG2, the C# standard committee.
C#
596
star
87

WatsonTcp

WatsonTcp is the easiest way to build TCP-based clients and servers in C#.
C#
585
star
88

dotnet-console-games

Game examples implemented as .NET console applications primarily for providing education and inspiration. :)
C#
569
star
89

dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
C#
558
star
90

dotnet-docker-samples

The .NET Core Docker samples have moved to https://github.com/dotnet/dotnet-docker/tree/master/samples
C#
543
star
91

dotnet-monitor

This repository contains the source code for .NET Monitor - a tool that allows you to gather diagnostic data from running applications using HTTP endpoints
C#
527
star
92

Nerdbank.Streams

Specialized .NET Streams and pipes for full duplex in-proc communication, web sockets, and multiplexing
C#
514
star
93

Kerberos.NET

A Kerberos implementation built entirely in managed code.
C#
513
star
94

blazor-samples

HTML
483
star
95

buildtools

Build tools that are necessary for building the .NET Core projects
479
star
96

roslyn-sdk

Roslyn-SDK templates and Syntax Visualizer
C#
470
star
97

core-setup

Installer packages for the .NET Core runtime and libraries
455
star
98

training-tutorials

Getting started tutorials for C# and ASP.NET
C#
414
star
99

WatsonWebserver

Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
C#
407
star
100

razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
C#
390
star