Support Raise.With for arbitrary delegates without requiring a typeparam in the call.
See original GitHub issueUpdate (@blairconrad): title changed after initial discussion among owners. I’ve left the original proposal here, but the goal of the issue has been expanded include support for all non-EventHandler
delegates.
Documentation says you have to specify generic type for Raise.With in case you use a custom delegate. And as I understand by “custom delegate” it measn everything besides EventHandler (which is not that popular for handling events besides Windows Forms). Would be nice to add support for Action and Func delegates as most of events are designed using them. Now we have to write something likes this:
realtimeManager.ConnectionStateChanged += Raise.With<Action<ConnectionState>>(ConnectionState.Connected);
instead of
realtimeManager.ConnectionStateChanged += Raise.With(ConnectionState.Connected);
Issue Analytics
- State:
- Created 7 years ago
- Comments:28 (26 by maintainers)
Top GitHub Comments
I have a POC for my
dynamic
idea. It lets you do this:(note that I had to use a different name for
With
to avoid the ambiguity I mentioned above; obviously we would have to pick a better name)Assignment to something other than a delegate or event with the correct signature throws an exception.
Glad you like the look of it @siberianguy. And as I type, NuGet has just finished indexing the packages. You can try it out right now!