Time to integrate Rx with .NET
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
#### Feature request
Please integrate System.Reactive into .NET and Standard, and eventually integrate with the .NET runtime core and languages.
Currently, events in C# can only be targeted either within their declaration class, or with the `+=` and `-=` operators.
This limitation results in plenty of tedious and redundant code, and a lot of verbosity. For example:
```c#
Observable.FromEventPattern(
h = PropertyChanged += h,
h = PropertyChanged -= h)
```
If we'd integrate Rx in .NET, we could end up removing such limitations, and reach the final goal where we're able to do something like the following:
```c#
EventPattern observable = myTextBox.TextChanged;
```
Hence:
```c#
var observable =
myTexBox
.TextChanged
.Throttle(TimeSpan.FromSeconds(.5))
.DistinctUntilChanged()
.Select(ep => (TextBox)ep.Sender))
.Select(tb => tb.Text)
.Where(text => text != null && text.Length > 3)
.Select(text => text.ToLower());
var subscription =
observable.Subscribe(text => MessgeBox.Show(text));
```
See [C# Suggestion](https://github.com/dotnet/csharplang/issues/2506) issue.
[Related](https://blogs.msdn.microsoft.com/dsyme/2006/03/23/f-first-class-events-simplicity-and-compositionality-in-imperative-reactive-programming/)
Bringing Rx to C# events will make it a super powerful language, especially around UIs.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.