ReactiveMarbles.ObservableEvents.SourceGenerator 1.3.1

dotnet add package ReactiveMarbles.ObservableEvents.SourceGenerator --version 1.3.1                
NuGet\Install-Package ReactiveMarbles.ObservableEvents.SourceGenerator -Version 1.3.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReactiveMarbles.ObservableEvents.SourceGenerator --version 1.3.1                
#r "nuget: ReactiveMarbles.ObservableEvents.SourceGenerator, 1.3.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ReactiveMarbles.ObservableEvents.SourceGenerator as a Cake Addin
#addin nuget:?package=ReactiveMarbles.ObservableEvents.SourceGenerator&version=1.3.1

// Install ReactiveMarbles.ObservableEvents.SourceGenerator as a Cake Tool
#tool nuget:?package=ReactiveMarbles.ObservableEvents.SourceGenerator&version=1.3.1                

<a href="https://github.com/reactivemarbles/observableevents"> <img width="150" src="./images/logo.png"/> </a>

Observable Event Generator

This project is a .NET source generator which produces IObservable<T> for events contained within a object including all base classes. ObservableEvents generator will convert events within an assembly and create observable wrappers for them, it is based on Pharmacist and uses .NET Source Generator technology.

NuGet Packages

Make sure your project is using the newer PackageReference inside your CSPROJ. The older style is buggy and should be moved away from regardless. See here for discussions how to upgrade.

Install the following packages to start using Observable Events.

Name Platform NuGet
ReactiveMarbles.ObservableEvents.SourceGenerator Core - Libary CoreBadge

Manual Installation

Include the following in your .csproj file

<PackageReference
    Include="ReactiveMarbles.ObservableEvents.SourceGenerator"
    Version="1.0.2"
    PrivateAssets="all" />

The PrivateAssets will prevent the ObservableEvents source generator from being inherited by other projects.

How to use

Instance Based

It injects a class for instance based events into your source code which will expose a extension method called Events(). You need to include the namespace ReactiveMarbles.ObservableEvents to access to the extension method. You can then use this to get IObservable<T> instances from your events.

using ReactiveMarbles.ObservableEvents;

public void MyClass : INotifyPropertyChanged
{
  // Assumes this belong in a class with a event called PropertyChanged.
  public void RunEvents()
  {
      this.Events().PropertyChanged.Subscribe(x => Console.WriteLine($"The {x} property has changed"));
  }

  public event PropertyChangedEventHandler PropertyChanged;
}

Static Events

You must use include a attribute GenerateStaticEventObservables on the assembly level for a particular class. This will generate a class RxEvents in the same namespace as the specified class.

[assembly: GenerateStaticEventObservablesAttribute(typeof(StaticTest))]
public static class StaticTest
{
    public static event EventHandler? TestChanged;
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ReactiveMarbles.ObservableEvents.SourceGenerator:

Package Downloads
SignalRChatClient

An Extension of the Microsoft.AspNetCore.SignalR.Client library

RxUIExt.WinUI

WinUI extensions and tools for RxUIExt.

GitHub repositories (9)

Showing the top 5 popular GitHub repositories that depend on ReactiveMarbles.ObservableEvents.SourceGenerator:

Repository Stars
gui-cs/Terminal.Gui
Cross Platform Terminal UI toolkit for .NET
HMBSbige/NatTypeTester
测试当前网络的 NAT 类型(STUN)
database64128/youtube-dl-wpf
A simple GUI wrapper for youtube-dl and yt-dlp.
HMBSbige/BilibiliLiveRecordDownLoader
Bilibili 直播录制
reactiveui/Camelotia
Cross-platform sample .NET GUI for cloud file management.
Version Downloads Last updated
1.3.1 53,464 10/2/2023
1.2.3 59,825 9/27/2022
1.1.4 38,619 8/29/2021
1.1.3 1,568 8/25/2021
1.0.10 719 5/31/2021
1.0.9 398 5/31/2021
1.0.8 380 5/31/2021
1.0.7 221 5/31/2021
1.0.6 221 5/31/2021
1.0.2 525 5/29/2021