<PackageReference Include="System.Reactive" Version="6.0.0-preview.1" />

FromEvent<TDelegate, TEventArgs>

sealed class FromEvent<TDelegate, TEventArgs> : ClassicEventProducer<TDelegate, TEventArgs>
using System.Reactive.Concurrency; using System.Runtime.CompilerServices; namespace System.Reactive.Linq.ObservableImpl { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] internal sealed class FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs> : ClassicEventProducer<TDelegate, TEventArgs> { [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] private readonly Func<Action<TEventArgs>, TDelegate> _conversion; public FromEvent(Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) : base(addHandler, removeHandler, scheduler) { } public FromEvent(Func<Action<TEventArgs>, TDelegate> conversion, Action<TDelegate> addHandler, Action<TDelegate> removeHandler, IScheduler scheduler) : base(addHandler, removeHandler, scheduler) { _conversion = conversion; } protected override TDelegate GetHandler(Action<TEventArgs> onNext) { if (_conversion != null) return _conversion(onNext); return ReflectionUtils.CreateDelegate<TDelegate>((object)onNext, typeof(Action<TEventArgs>).GetMethod("Invoke")); } } }