|
6 | 6 | using System.Reactive;
|
7 | 7 | using System.Reactive.Linq;
|
8 | 8 |
|
9 |
| -namespace ReactiveMarbles.Extensions |
| 9 | +namespace ReactiveMarbles.Extensions; |
| 10 | + |
| 11 | +/// <summary> |
| 12 | +/// Extension methods for <see cref="System.Reactive"/>. |
| 13 | +/// </summary> |
| 14 | +public static class ReactiveExtensions |
10 | 15 | {
|
11 | 16 | /// <summary>
|
12 |
| - /// Extension methods for <see cref="System.Reactive"/>. |
| 17 | + /// Returns only values that are not null. |
| 18 | + /// Converts the nullability. |
13 | 19 | /// </summary>
|
14 |
| - public static class ReactiveExtensions |
15 |
| - { |
16 |
| - /// <summary> |
17 |
| - /// Returns only values that are not null. |
18 |
| - /// Converts the nullability. |
19 |
| - /// </summary> |
20 |
| - /// <typeparam name="T">The type of value emitted by the observable.</typeparam> |
21 |
| - /// <param name="observable">The observable that can contain nulls.</param> |
22 |
| - /// <returns>A non nullable version of the observable that only emits valid values.</returns> |
23 |
| - public static IObservable<T> WhereIsNotNull<T>(this IObservable<T> observable) => |
24 |
| - observable |
25 |
| - .Where(x => x is not null); |
| 20 | + /// <typeparam name="T">The type of value emitted by the observable.</typeparam> |
| 21 | + /// <param name="observable">The observable that can contain nulls.</param> |
| 22 | + /// <returns>A non nullable version of the observable that only emits valid values.</returns> |
| 23 | + public static IObservable<T> WhereIsNotNull<T>(this IObservable<T> observable) => |
| 24 | + observable |
| 25 | + .Where(x => x is not null); |
26 | 26 |
|
27 |
| - /// <summary> |
28 |
| - /// Will convert an observable so that it's value is ignored and converted into just returning <see cref="Unit"/>. |
29 |
| - /// This allows us just to be notified when the observable signals. |
30 |
| - /// </summary> |
31 |
| - /// <typeparam name="T">The current type of the observable.</typeparam> |
32 |
| - /// <param name="observable">The observable to convert.</param> |
33 |
| - /// <returns>The converted observable.</returns> |
34 |
| - public static IObservable<Unit> AsSignal<T>(this IObservable<T> observable) => |
35 |
| - observable |
36 |
| - .Select(_ => Unit.Default); |
37 |
| - } |
| 27 | + /// <summary> |
| 28 | + /// Change the source observable type to <see cref="Unit"/>. |
| 29 | + /// This allows us to be notified when the observable emits a value. |
| 30 | + /// </summary> |
| 31 | + /// <typeparam name="T">The current type of the observable.</typeparam> |
| 32 | + /// <param name="observable">The observable to convert.</param> |
| 33 | + /// <returns>The signal.</returns> |
| 34 | + public static IObservable<Unit> AsSignal<T>(this IObservable<T> observable) => |
| 35 | + observable |
| 36 | + .Select(_ => Unit.Default); |
38 | 37 | }
|
0 commit comments