ToEventPattern.cs 660 B

1234567891011121314151617
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Reactive.Linq
  5. {
  6. partial class AsyncObservable
  7. {
  8. public static IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(this IAsyncObservable<EventPattern<TEventArgs>> source)
  9. {
  10. if (source == null)
  11. throw new ArgumentNullException(nameof(source));
  12. return new EventPatternSource<TEventArgs>(source, (onNext, e) => onNext(e.Sender, e.EventArgs));
  13. }
  14. }
  15. }