44
55namespace MorleyDev . Reactive . Monad . Extensions
66{
7- public static class IOExtensions
7+ public static class IOExtensionsNestedEnumerable
88 {
9+ /// <summary>
10+ /// Merge an IO of an Enumerable into a ManyIO
11+ /// </summary>
12+ /// <typeparam name="T"></typeparam>
13+ /// <typeparam name="U"></typeparam>
14+ /// <param name="self"></param>
15+ /// <returns></returns>
16+ public static ManyIO < T > Merge < T , U > ( this IO < U > self ) where U : IEnumerable < T > => self . Select ( s => s . ToObservable ( ) ) . Merge ( ) . ToManyIO ( ) ;
917
1018 /// <summary>
11- /// Merge an IO of an Array into a ManyIO
19+ /// Merge an IO of an Enumerable into a ManyIO
20+ /// </summary>
21+ /// <typeparam name="T"></typeparam>
22+ /// <typeparam name="U"></typeparam>
23+ /// <param name="self"></param>
24+ /// <returns></returns>
25+ public static ManyIO < T > Concat < T , U > ( this IO < U > self ) where U : IEnumerable < T > => self . Select ( s => s . ToObservable ( ) ) . Concat ( ) . ToManyIO ( ) ;
26+ }
27+
28+ public static class IOExtensionsNestedObservable
29+ {
30+
31+ /// <summary>
32+ /// Merge an IO of an Enumerable into a ManyIO
1233 /// </summary>
1334 /// <typeparam name="T"></typeparam>
35+ /// <typeparam name="U"></typeparam>
1436 /// <param name="self"></param>
1537 /// <returns></returns>
16- public static ManyIO < T > Merge < T > ( this IO < T [ ] > self ) => self . Select ( s => s . ToObservable ( ) ) . Merge ( ) . ToManyIO ( ) ;
38+ public static ManyIO < T > Merge < T , U > ( this IO < U > self ) where U : IObservable < T > => self . SelectMany ( s => s ) . ToManyIO ( ) ;
1739
1840 /// <summary>
1941 /// Merge an IO of an Enumerable into a ManyIO
2042 /// </summary>
2143 /// <typeparam name="T"></typeparam>
44+ /// <typeparam name="U"></typeparam>
2245 /// <param name="self"></param>
2346 /// <returns></returns>
24- public static ManyIO < T > Merge < T > ( this IO < IEnumerable < T > > self ) => self . Select ( s => s . ToObservable ( ) ) . Merge ( ) . ToManyIO ( ) ;
47+ public static ManyIO < T > Concat < T , U > ( this IO < U > self ) where U : IObservable < T > => self . Select ( s => ( IObservable < T > ) s ) . Concat ( ) . ToManyIO ( ) ;
2548 }
26- }
49+ }
0 commit comments