Skip to content

Added AutoEvent#13

Open
Bastani wants to merge 4 commits intomainfrom
AutoEvent
Open

Added AutoEvent#13
Bastani wants to merge 4 commits intomainfrom
AutoEvent

Conversation

@Bastani
Copy link
Copy Markdown
Contributor

@Bastani Bastani commented Apr 29, 2026

Figured since we're using this as a reactive library that maybe we should have a way to convert C# events into sync subjects. Should help if someone wants to use this with DisposableCollections!

@wlsnmrk
Copy link
Copy Markdown
Contributor

wlsnmrk commented Apr 29, 2026

This is neat! Would it be worth including events with other arities? (Maybe like zero through three params?)

@Bastani
Copy link
Copy Markdown
Contributor Author

Bastani commented Apr 29, 2026

@wlsnmrk I was thinking of these two options.

  1. Add a new constructor with a conversion method so that whenever the event fires, it can then be mapped to one singular output type, this should cover every case, but it might be a bit clunky to write.

  2. Add a bunch of static factory methods with multiple type arguments, but then I think we'd potentially need multiple implementations of AutoEvent, one for each permutation

Maybe both? From what I've seen with the .NET RX library they have FromEvent which can be overloaded with a conversion parameter and FromEventHandlerPattern, which is just the classic (object sender, TEventArgs args)

@CaseyHofland
Copy link
Copy Markdown
Contributor

CaseyHofland commented May 3, 2026

  1. Add a bunch of static factory methods with multiple type arguments, but then I think we'd potentially need multiple implementations of AutoEvent, one for each permutation

I'd personally like this best, because it is the most .NET-like (no need to relearn anything).

But the way I'd do it is write a text template to generate all the relevant AutoEvents for 0-16 arguments and keep them in lockstep should they ever change. Perfect for this are Design-time T4 templates.

Also: what about Func? 🪩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants