Debian Codegraph @

external/rx/Rx/NET/Source/System.Reactive.Providers/Reactive/Linq/Qbservable.Generated.cs

raw
1 /*
2 * WARNING: Auto-generated file (11/21/2013 11:07:25 AM)
3 * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory).
4 */
5
6 #pragma warning disable 1591
7
8 #if !NO_EXPRESSIONS
9
10 using System;
11 using System.Reactive.Concurrency;
12 using System.Collections.Generic;
13 using System.Reactive.Joins;
14 using System.Linq;
15 using System.Linq.Expressions;
16 using System.Reflection;
17 using System.Threading;
18 using System.Reactive;
19 using System.Reactive.Subjects;
20 #if !NO_TPL
21 using System.Threading.Tasks;
22 #endif
23 #if !NO_REMOTING
24 using System.Runtime.Remoting.Lifetime;
25 #endif
26
27 namespace System.Reactive.Linq
28 {
29 public static partial class Qbservable
30 {
31 /// <summary>
32 /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence.
33 /// For aggregation behavior with incremental intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Scan``1(System.IObservable{``0},System.Func{``0,``0,``0})" />.
34 /// </summary>
35 /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
36 /// <param name="source">An observable sequence to aggregate over.</param>
37 /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
38 /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
39 /// <exception cref="T:System.ArgumentNullException">
40 /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
41 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
42 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
43 public static IQbservable<TSource> Aggregate<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
44 {
45 if (source == null)
46 throw new ArgumentNullException("source");
47 if (accumulator == null)
48 throw new ArgumentNullException("accumulator");
49
50 return source.Provider.CreateQuery<TSource>(
51 Expression.Call(
52 null,
53 #if CRIPPLED_REFLECTION
54 InfoOf(() => Qbservable.Aggregate<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))),
55 #else
56 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
57 #endif
58 source.Expression,
59 accumulator
60 )
61 );
62 }
63
64 /// <summary>
65 /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
66 /// For aggregation behavior with incremental intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Scan``2(System.IObservable{``0},``1,System.Func{``1,``0,``1})" />.
67 /// </summary>
68 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
69 /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
70 /// <param name="source">An observable sequence to aggregate over.</param>
71 /// <param name="seed">The initial accumulator value.</param>
72 /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
73 /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
74 /// <exception cref="T:System.ArgumentNullException">
75 /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
76 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
77 public static IQbservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
78 {
79 if (source == null)
80 throw new ArgumentNullException("source");
81 if (accumulator == null)
82 throw new ArgumentNullException("accumulator");
83
84 return source.Provider.CreateQuery<TAccumulate>(
85 Expression.Call(
86 null,
87 #if CRIPPLED_REFLECTION
88 InfoOf(() => Qbservable.Aggregate<TSource, TAccumulate>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))),
89 #else
90 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)),
91 #endif
92 source.Expression,
93 Expression.Constant(seed, typeof(TAccumulate)),
94 accumulator
95 )
96 );
97 }
98
99 /// <summary>
100 /// Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value,
101 /// and the specified result selector function is used to select the result value.
102 /// </summary>
103 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
104 /// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
105 /// <typeparam name="TResult">The type of the resulting value.</typeparam>
106 /// <param name="source">An observable sequence to aggregate over.</param>
107 /// <param name="seed">The initial accumulator value.</param>
108 /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
109 /// <param name="resultSelector">A function to transform the final accumulator value into the result value.</param>
110 /// <returns>An observable sequence containing a single element with the final accumulator value.</returns>
111 /// <exception cref="T:System.ArgumentNullException">
112 /// <paramref name="source" /> or <paramref name="accumulator" /> or <paramref name="resultSelector" /> is null.</exception>
113 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
114 public static IQbservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)
115 {
116 if (source == null)
117 throw new ArgumentNullException("source");
118 if (accumulator == null)
119 throw new ArgumentNullException("accumulator");
120 if (resultSelector == null)
121 throw new ArgumentNullException("resultSelector");
122
123 return source.Provider.CreateQuery<TResult>(
124 Expression.Call(
125 null,
126 #if CRIPPLED_REFLECTION
127 InfoOf(() => Qbservable.Aggregate<TSource, TAccumulate, TResult>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>))),
128 #else
129 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)),
130 #endif
131 source.Expression,
132 Expression.Constant(seed, typeof(TAccumulate)),
133 accumulator,
134 resultSelector
135 )
136 );
137 }
138
139 /// <summary>
140 /// Determines whether all elements of an observable sequence satisfy a condition.
141 /// </summary>
142 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
143 /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
144 /// <param name="predicate">A function to test each element for a condition.</param>
145 /// <returns>An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.</returns>
146 /// <exception cref="T:System.ArgumentNullException">
147 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
148 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
149 public static IQbservable<bool> All<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
150 {
151 if (source == null)
152 throw new ArgumentNullException("source");
153 if (predicate == null)
154 throw new ArgumentNullException("predicate");
155
156 return source.Provider.CreateQuery<bool>(
157 Expression.Call(
158 null,
159 #if CRIPPLED_REFLECTION
160 InfoOf(() => Qbservable.All<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
161 #else
162 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
163 #endif
164 source.Expression,
165 predicate
166 )
167 );
168 }
169
170 /// <summary>
171 /// Propagates the observable sequence that reacts first.
172 /// </summary>
173 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
174 /// <param name="first">First observable sequence.</param>
175 /// <param name="second">Second observable sequence.</param>
176 /// <returns>An observable sequence that surfaces either of the given sequences, whichever reacted first.</returns>
177 /// <exception cref="T:System.ArgumentNullException">
178 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
179 public static IQbservable<TSource> Amb<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
180 {
181 if (first == null)
182 throw new ArgumentNullException("first");
183 if (second == null)
184 throw new ArgumentNullException("second");
185
186 return first.Provider.CreateQuery<TSource>(
187 Expression.Call(
188 null,
189 #if CRIPPLED_REFLECTION
190 InfoOf(() => Qbservable.Amb<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
191 #else
192 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
193 #endif
194 first.Expression,
195 GetSourceExpression(second)
196 )
197 );
198 }
199
200 /// <summary>
201 /// Propagates the observable sequence that reacts first.
202 /// </summary>
203 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
204 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
205 /// <param name="sources">Observable sources competing to react first.</param>
206 /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
207 /// <exception cref="T:System.ArgumentNullException">
208 /// <paramref name="sources" /> is null.</exception>
209 public static IQbservable<TSource> Amb<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
210 {
211 if (provider == null)
212 throw new ArgumentNullException("provider");
213 if (sources == null)
214 throw new ArgumentNullException("sources");
215
216 return provider.CreateQuery<TSource>(
217 Expression.Call(
218 null,
219 #if CRIPPLED_REFLECTION
220 InfoOf(() => Qbservable.Amb<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
221 #else
222 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
223 #endif
224 Expression.Constant(provider, typeof(IQbservableProvider)),
225 GetSourceExpression(sources)
226 )
227 );
228 }
229
230 /// <summary>
231 /// Propagates the observable sequence that reacts first.
232 /// </summary>
233 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
234 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
235 /// <param name="sources">Observable sources competing to react first.</param>
236 /// <returns>An observable sequence that surfaces any of the given sequences, whichever reacted first.</returns>
237 /// <exception cref="T:System.ArgumentNullException">
238 /// <paramref name="sources" /> is null.</exception>
239 public static IQbservable<TSource> Amb<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
240 {
241 if (provider == null)
242 throw new ArgumentNullException("provider");
243 if (sources == null)
244 throw new ArgumentNullException("sources");
245
246 return provider.CreateQuery<TSource>(
247 Expression.Call(
248 null,
249 #if CRIPPLED_REFLECTION
250 InfoOf(() => Qbservable.Amb<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
251 #else
252 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
253 #endif
254 Expression.Constant(provider, typeof(IQbservableProvider)),
255 GetSourceExpression(sources)
256 )
257 );
258 }
259
260 /// <summary>
261 /// Determines whether an observable sequence contains any elements.
262 /// </summary>
263 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
264 /// <param name="source">An observable sequence to check for non-emptiness.</param>
265 /// <returns>An observable sequence containing a single element determining whether the source sequence contains any elements.</returns>
266 /// <exception cref="T:System.ArgumentNullException">
267 /// <paramref name="source" /> is null.</exception>
268 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
269 public static IQbservable<bool> Any<TSource>(this IQbservable<TSource> source)
270 {
271 if (source == null)
272 throw new ArgumentNullException("source");
273
274 return source.Provider.CreateQuery<bool>(
275 Expression.Call(
276 null,
277 #if CRIPPLED_REFLECTION
278 InfoOf(() => Qbservable.Any<TSource>(default(IQbservable<TSource>))),
279 #else
280 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
281 #endif
282 source.Expression
283 )
284 );
285 }
286
287 /// <summary>
288 /// Determines whether any element of an observable sequence satisfies a condition.
289 /// </summary>
290 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
291 /// <param name="source">An observable sequence whose elements to apply the predicate to.</param>
292 /// <param name="predicate">A function to test each element for a condition.</param>
293 /// <returns>An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate.</returns>
294 /// <exception cref="T:System.ArgumentNullException">
295 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
296 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
297 public static IQbservable<bool> Any<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
298 {
299 if (source == null)
300 throw new ArgumentNullException("source");
301 if (predicate == null)
302 throw new ArgumentNullException("predicate");
303
304 return source.Provider.CreateQuery<bool>(
305 Expression.Call(
306 null,
307 #if CRIPPLED_REFLECTION
308 InfoOf(() => Qbservable.Any<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
309 #else
310 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
311 #endif
312 source.Expression,
313 predicate
314 )
315 );
316 }
317
318 /// <summary>
319 /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values.
320 /// </summary>
321 /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
322 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
323 /// <exception cref="T:System.ArgumentNullException">
324 /// <paramref name="source" /> is null.</exception>
325 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
326 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
327 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
328 public static IQbservable<decimal> Average(this IQbservable<decimal> source)
329 {
330 if (source == null)
331 throw new ArgumentNullException("source");
332
333 return source.Provider.CreateQuery<decimal>(
334 Expression.Call(
335 null,
336 #if CRIPPLED_REFLECTION
337 InfoOf(() => Qbservable.Average(default(IQbservable<decimal>))),
338 #else
339 (MethodInfo)MethodInfo.GetCurrentMethod(),
340 #endif
341 source.Expression
342 )
343 );
344 }
345
346 /// <summary>
347 /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values.
348 /// </summary>
349 /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
350 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
351 /// <exception cref="T:System.ArgumentNullException">
352 /// <paramref name="source" /> is null.</exception>
353 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
354 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
355 public static IQbservable<double> Average(this IQbservable<double> source)
356 {
357 if (source == null)
358 throw new ArgumentNullException("source");
359
360 return source.Provider.CreateQuery<double>(
361 Expression.Call(
362 null,
363 #if CRIPPLED_REFLECTION
364 InfoOf(() => Qbservable.Average(default(IQbservable<double>))),
365 #else
366 (MethodInfo)MethodInfo.GetCurrentMethod(),
367 #endif
368 source.Expression
369 )
370 );
371 }
372
373 /// <summary>
374 /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values.
375 /// </summary>
376 /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
377 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
378 /// <exception cref="T:System.ArgumentNullException">
379 /// <paramref name="source" /> is null.</exception>
380 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
381 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
382 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
383 public static IQbservable<double> Average(this IQbservable<int> source)
384 {
385 if (source == null)
386 throw new ArgumentNullException("source");
387
388 return source.Provider.CreateQuery<double>(
389 Expression.Call(
390 null,
391 #if CRIPPLED_REFLECTION
392 InfoOf(() => Qbservable.Average(default(IQbservable<int>))),
393 #else
394 (MethodInfo)MethodInfo.GetCurrentMethod(),
395 #endif
396 source.Expression
397 )
398 );
399 }
400
401 /// <summary>
402 /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values.
403 /// </summary>
404 /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
405 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
406 /// <exception cref="T:System.ArgumentNullException">
407 /// <paramref name="source" /> is null.</exception>
408 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
409 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
410 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
411 public static IQbservable<double> Average(this IQbservable<long> source)
412 {
413 if (source == null)
414 throw new ArgumentNullException("source");
415
416 return source.Provider.CreateQuery<double>(
417 Expression.Call(
418 null,
419 #if CRIPPLED_REFLECTION
420 InfoOf(() => Qbservable.Average(default(IQbservable<long>))),
421 #else
422 (MethodInfo)MethodInfo.GetCurrentMethod(),
423 #endif
424 source.Expression
425 )
426 );
427 }
428
429 /// <summary>
430 /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values.
431 /// </summary>
432 /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
433 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
434 /// <exception cref="T:System.ArgumentNullException">
435 /// <paramref name="source" /> is null.</exception>
436 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
437 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
438 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
439 public static IQbservable<decimal?> Average(this IQbservable<decimal?> source)
440 {
441 if (source == null)
442 throw new ArgumentNullException("source");
443
444 return source.Provider.CreateQuery<decimal?>(
445 Expression.Call(
446 null,
447 #if CRIPPLED_REFLECTION
448 InfoOf(() => Qbservable.Average(default(IQbservable<decimal?>))),
449 #else
450 (MethodInfo)MethodInfo.GetCurrentMethod(),
451 #endif
452 source.Expression
453 )
454 );
455 }
456
457 /// <summary>
458 /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values.
459 /// </summary>
460 /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
461 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
462 /// <exception cref="T:System.ArgumentNullException">
463 /// <paramref name="source" /> is null.</exception>
464 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
465 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
466 public static IQbservable<double?> Average(this IQbservable<double?> source)
467 {
468 if (source == null)
469 throw new ArgumentNullException("source");
470
471 return source.Provider.CreateQuery<double?>(
472 Expression.Call(
473 null,
474 #if CRIPPLED_REFLECTION
475 InfoOf(() => Qbservable.Average(default(IQbservable<double?>))),
476 #else
477 (MethodInfo)MethodInfo.GetCurrentMethod(),
478 #endif
479 source.Expression
480 )
481 );
482 }
483
484 /// <summary>
485 /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values.
486 /// </summary>
487 /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
488 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
489 /// <exception cref="T:System.ArgumentNullException">
490 /// <paramref name="source" /> is null.</exception>
491 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
492 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
493 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
494 public static IQbservable<double?> Average(this IQbservable<int?> source)
495 {
496 if (source == null)
497 throw new ArgumentNullException("source");
498
499 return source.Provider.CreateQuery<double?>(
500 Expression.Call(
501 null,
502 #if CRIPPLED_REFLECTION
503 InfoOf(() => Qbservable.Average(default(IQbservable<int?>))),
504 #else
505 (MethodInfo)MethodInfo.GetCurrentMethod(),
506 #endif
507 source.Expression
508 )
509 );
510 }
511
512 /// <summary>
513 /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values.
514 /// </summary>
515 /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
516 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
517 /// <exception cref="T:System.ArgumentNullException">
518 /// <paramref name="source" /> is null.</exception>
519 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
520 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
521 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
522 public static IQbservable<double?> Average(this IQbservable<long?> source)
523 {
524 if (source == null)
525 throw new ArgumentNullException("source");
526
527 return source.Provider.CreateQuery<double?>(
528 Expression.Call(
529 null,
530 #if CRIPPLED_REFLECTION
531 InfoOf(() => Qbservable.Average(default(IQbservable<long?>))),
532 #else
533 (MethodInfo)MethodInfo.GetCurrentMethod(),
534 #endif
535 source.Expression
536 )
537 );
538 }
539
540 /// <summary>
541 /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values.
542 /// </summary>
543 /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
544 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
545 /// <exception cref="T:System.ArgumentNullException">
546 /// <paramref name="source" /> is null.</exception>
547 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
548 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
549 public static IQbservable<float?> Average(this IQbservable<float?> source)
550 {
551 if (source == null)
552 throw new ArgumentNullException("source");
553
554 return source.Provider.CreateQuery<float?>(
555 Expression.Call(
556 null,
557 #if CRIPPLED_REFLECTION
558 InfoOf(() => Qbservable.Average(default(IQbservable<float?>))),
559 #else
560 (MethodInfo)MethodInfo.GetCurrentMethod(),
561 #endif
562 source.Expression
563 )
564 );
565 }
566
567 /// <summary>
568 /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values.
569 /// </summary>
570 /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
571 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
572 /// <exception cref="T:System.ArgumentNullException">
573 /// <paramref name="source" /> is null.</exception>
574 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
575 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
576 public static IQbservable<float> Average(this IQbservable<float> source)
577 {
578 if (source == null)
579 throw new ArgumentNullException("source");
580
581 return source.Provider.CreateQuery<float>(
582 Expression.Call(
583 null,
584 #if CRIPPLED_REFLECTION
585 InfoOf(() => Qbservable.Average(default(IQbservable<float>))),
586 #else
587 (MethodInfo)MethodInfo.GetCurrentMethod(),
588 #endif
589 source.Expression
590 )
591 );
592 }
593
594 /// <summary>
595 /// Computes the average of an observable sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
596 /// </summary>
597 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
598 /// <param name="source">A sequence of values to calculate the average of.</param>
599 /// <param name="selector">A transform function to apply to each element.</param>
600 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
601 /// <exception cref="T:System.ArgumentNullException">
602 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
603 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
604 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
605 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
606 public static IQbservable<decimal> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
607 {
608 if (source == null)
609 throw new ArgumentNullException("source");
610 if (selector == null)
611 throw new ArgumentNullException("selector");
612
613 return source.Provider.CreateQuery<decimal>(
614 Expression.Call(
615 null,
616 #if CRIPPLED_REFLECTION
617 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
618 #else
619 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
620 #endif
621 source.Expression,
622 selector
623 )
624 );
625 }
626
627 /// <summary>
628 /// Computes the average of an observable sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
629 /// </summary>
630 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
631 /// <param name="source">A sequence of values to calculate the average of.</param>
632 /// <param name="selector">A transform function to apply to each element.</param>
633 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
634 /// <exception cref="T:System.ArgumentNullException">
635 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
636 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
637 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
638 public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
639 {
640 if (source == null)
641 throw new ArgumentNullException("source");
642 if (selector == null)
643 throw new ArgumentNullException("selector");
644
645 return source.Provider.CreateQuery<double>(
646 Expression.Call(
647 null,
648 #if CRIPPLED_REFLECTION
649 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
650 #else
651 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
652 #endif
653 source.Expression,
654 selector
655 )
656 );
657 }
658
659 /// <summary>
660 /// Computes the average of an observable sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
661 /// </summary>
662 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
663 /// <param name="source">A sequence of values to calculate the average of.</param>
664 /// <param name="selector">A transform function to apply to each element.</param>
665 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
666 /// <exception cref="T:System.ArgumentNullException">
667 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
668 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
669 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
670 public static IQbservable<float> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
671 {
672 if (source == null)
673 throw new ArgumentNullException("source");
674 if (selector == null)
675 throw new ArgumentNullException("selector");
676
677 return source.Provider.CreateQuery<float>(
678 Expression.Call(
679 null,
680 #if CRIPPLED_REFLECTION
681 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
682 #else
683 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
684 #endif
685 source.Expression,
686 selector
687 )
688 );
689 }
690
691 /// <summary>
692 /// Computes the average of an observable sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
693 /// </summary>
694 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
695 /// <param name="source">A sequence of values to calculate the average of.</param>
696 /// <param name="selector">A transform function to apply to each element.</param>
697 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
698 /// <exception cref="T:System.ArgumentNullException">
699 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
700 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
701 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
702 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
703 public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
704 {
705 if (source == null)
706 throw new ArgumentNullException("source");
707 if (selector == null)
708 throw new ArgumentNullException("selector");
709
710 return source.Provider.CreateQuery<double>(
711 Expression.Call(
712 null,
713 #if CRIPPLED_REFLECTION
714 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
715 #else
716 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
717 #endif
718 source.Expression,
719 selector
720 )
721 );
722 }
723
724 /// <summary>
725 /// Computes the average of an observable sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
726 /// </summary>
727 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
728 /// <param name="source">A sequence of values to calculate the average of.</param>
729 /// <param name="selector">A transform function to apply to each element.</param>
730 /// <returns>An observable sequence containing a single element with the average of the sequence of values.</returns>
731 /// <exception cref="T:System.ArgumentNullException">
732 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
733 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
734 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
735 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
736 public static IQbservable<double> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
737 {
738 if (source == null)
739 throw new ArgumentNullException("source");
740 if (selector == null)
741 throw new ArgumentNullException("selector");
742
743 return source.Provider.CreateQuery<double>(
744 Expression.Call(
745 null,
746 #if CRIPPLED_REFLECTION
747 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
748 #else
749 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
750 #endif
751 source.Expression,
752 selector
753 )
754 );
755 }
756
757 /// <summary>
758 /// Computes the average of an observable sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
759 /// </summary>
760 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
761 /// <param name="source">A sequence of values to calculate the average of.</param>
762 /// <param name="selector">A transform function to apply to each element.</param>
763 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
764 /// <exception cref="T:System.ArgumentNullException">
765 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
766 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
767 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
768 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
769 public static IQbservable<decimal?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
770 {
771 if (source == null)
772 throw new ArgumentNullException("source");
773 if (selector == null)
774 throw new ArgumentNullException("selector");
775
776 return source.Provider.CreateQuery<decimal?>(
777 Expression.Call(
778 null,
779 #if CRIPPLED_REFLECTION
780 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
781 #else
782 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
783 #endif
784 source.Expression,
785 selector
786 )
787 );
788 }
789
790 /// <summary>
791 /// Computes the average of an observable sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
792 /// </summary>
793 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
794 /// <param name="source">A sequence of values to calculate the average of.</param>
795 /// <param name="selector">A transform function to apply to each element.</param>
796 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
797 /// <exception cref="T:System.ArgumentNullException">
798 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
799 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
800 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
801 public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
802 {
803 if (source == null)
804 throw new ArgumentNullException("source");
805 if (selector == null)
806 throw new ArgumentNullException("selector");
807
808 return source.Provider.CreateQuery<double?>(
809 Expression.Call(
810 null,
811 #if CRIPPLED_REFLECTION
812 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
813 #else
814 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
815 #endif
816 source.Expression,
817 selector
818 )
819 );
820 }
821
822 /// <summary>
823 /// Computes the average of an observable sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
824 /// </summary>
825 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
826 /// <param name="source">A sequence of values to calculate the average of.</param>
827 /// <param name="selector">A transform function to apply to each element.</param>
828 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
829 /// <exception cref="T:System.ArgumentNullException">
830 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
831 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
832 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
833 public static IQbservable<float?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
834 {
835 if (source == null)
836 throw new ArgumentNullException("source");
837 if (selector == null)
838 throw new ArgumentNullException("selector");
839
840 return source.Provider.CreateQuery<float?>(
841 Expression.Call(
842 null,
843 #if CRIPPLED_REFLECTION
844 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
845 #else
846 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
847 #endif
848 source.Expression,
849 selector
850 )
851 );
852 }
853
854 /// <summary>
855 /// Computes the average of an observable sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
856 /// </summary>
857 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
858 /// <param name="source">A sequence of values to calculate the average of.</param>
859 /// <param name="selector">A transform function to apply to each element.</param>
860 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
861 /// <exception cref="T:System.ArgumentNullException">
862 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
863 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
864 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
865 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
866 public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
867 {
868 if (source == null)
869 throw new ArgumentNullException("source");
870 if (selector == null)
871 throw new ArgumentNullException("selector");
872
873 return source.Provider.CreateQuery<double?>(
874 Expression.Call(
875 null,
876 #if CRIPPLED_REFLECTION
877 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
878 #else
879 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
880 #endif
881 source.Expression,
882 selector
883 )
884 );
885 }
886
887 /// <summary>
888 /// Computes the average of an observable sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
889 /// </summary>
890 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
891 /// <param name="source">A sequence of values to calculate the average of.</param>
892 /// <param name="selector">A transform function to apply to each element.</param>
893 /// <returns>An observable sequence containing a single element with the average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
894 /// <exception cref="T:System.ArgumentNullException">
895 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
896 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
897 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
898 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
899 public static IQbservable<double?> Average<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
900 {
901 if (source == null)
902 throw new ArgumentNullException("source");
903 if (selector == null)
904 throw new ArgumentNullException("selector");
905
906 return source.Provider.CreateQuery<double?>(
907 Expression.Call(
908 null,
909 #if CRIPPLED_REFLECTION
910 InfoOf(() => Qbservable.Average<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
911 #else
912 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
913 #endif
914 source.Expression,
915 selector
916 )
917 );
918 }
919
920 /// <summary>
921 /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on element count information.
922 /// </summary>
923 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
924 /// <param name="source">Source sequence to produce buffers over.</param>
925 /// <param name="count">Length of each buffer.</param>
926 /// <returns>An observable sequence of buffers.</returns>
927 /// <exception cref="T:System.ArgumentNullException">
928 /// <paramref name="source" /> is null.</exception>
929 /// <exception cref="T:System.ArgumentOutOfRangeException">
930 /// <paramref name="count" /> is less than or equal to zero.</exception>
931 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, int count)
932 {
933 if (source == null)
934 throw new ArgumentNullException("source");
935
936 return source.Provider.CreateQuery<IList<TSource>>(
937 Expression.Call(
938 null,
939 #if CRIPPLED_REFLECTION
940 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(int))),
941 #else
942 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
943 #endif
944 source.Expression,
945 Expression.Constant(count, typeof(int))
946 )
947 );
948 }
949
950 /// <summary>
951 /// Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
952 /// </summary>
953 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
954 /// <param name="source">Source sequence to produce buffers over.</param>
955 /// <param name="count">Length of each buffer.</param>
956 /// <param name="skip">Number of elements to skip between creation of consecutive buffers.</param>
957 /// <returns>An observable sequence of buffers.</returns>
958 /// <exception cref="T:System.ArgumentNullException">
959 /// <paramref name="source" /> is null.</exception>
960 /// <exception cref="T:System.ArgumentOutOfRangeException">
961 /// <paramref name="count" /> or <paramref name="skip" /> is less than or equal to zero.</exception>
962 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, int count, int skip)
963 {
964 if (source == null)
965 throw new ArgumentNullException("source");
966
967 return source.Provider.CreateQuery<IList<TSource>>(
968 Expression.Call(
969 null,
970 #if CRIPPLED_REFLECTION
971 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(int), default(int))),
972 #else
973 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
974 #endif
975 source.Expression,
976 Expression.Constant(count, typeof(int)),
977 Expression.Constant(skip, typeof(int))
978 )
979 );
980 }
981
982 /// <summary>
983 /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information.
984 /// </summary>
985 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
986 /// <param name="source">Source sequence to produce buffers over.</param>
987 /// <param name="timeSpan">Length of each buffer.</param>
988 /// <returns>An observable sequence of buffers.</returns>
989 /// <exception cref="T:System.ArgumentNullException">
990 /// <paramref name="source" /> is null.</exception>
991 /// <exception cref="T:System.ArgumentOutOfRangeException">
992 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
993 /// <remarks>
994 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
995 /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
996 /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
997 /// </remarks>
998 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)
999 {
1000 if (source == null)
1001 throw new ArgumentNullException("source");
1002
1003 return source.Provider.CreateQuery<IList<TSource>>(
1004 Expression.Call(
1005 null,
1006 #if CRIPPLED_REFLECTION
1007 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
1008 #else
1009 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1010 #endif
1011 source.Expression,
1012 Expression.Constant(timeSpan, typeof(TimeSpan))
1013 )
1014 );
1015 }
1016
1017 /// <summary>
1018 /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed.
1019 /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
1020 /// </summary>
1021 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1022 /// <param name="source">Source sequence to produce buffers over.</param>
1023 /// <param name="timeSpan">Maximum time length of a window.</param>
1024 /// <param name="count">Maximum element count of a window.</param>
1025 /// <returns>An observable sequence of buffers.</returns>
1026 /// <exception cref="T:System.ArgumentNullException">
1027 /// <paramref name="source" /> is null.</exception>
1028 /// <exception cref="T:System.ArgumentOutOfRangeException">
1029 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
1030 /// <remarks>
1031 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
1032 /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
1033 /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
1034 /// </remarks>
1035 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)
1036 {
1037 if (source == null)
1038 throw new ArgumentNullException("source");
1039
1040 return source.Provider.CreateQuery<IList<TSource>>(
1041 Expression.Call(
1042 null,
1043 #if CRIPPLED_REFLECTION
1044 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int))),
1045 #else
1046 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1047 #endif
1048 source.Expression,
1049 Expression.Constant(timeSpan, typeof(TimeSpan)),
1050 Expression.Constant(count, typeof(int))
1051 )
1052 );
1053 }
1054
1055 /// <summary>
1056 /// Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
1057 /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
1058 /// </summary>
1059 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1060 /// <param name="source">Source sequence to produce buffers over.</param>
1061 /// <param name="timeSpan">Maximum time length of a buffer.</param>
1062 /// <param name="count">Maximum element count of a buffer.</param>
1063 /// <param name="scheduler">Scheduler to run buffering timers on.</param>
1064 /// <returns>An observable sequence of buffers.</returns>
1065 /// <exception cref="T:System.ArgumentNullException">
1066 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
1067 /// <exception cref="T:System.ArgumentOutOfRangeException">
1068 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
1069 /// <remarks>
1070 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
1071 /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
1072 /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
1073 /// </remarks>
1074 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
1075 {
1076 if (source == null)
1077 throw new ArgumentNullException("source");
1078 if (scheduler == null)
1079 throw new ArgumentNullException("scheduler");
1080
1081 return source.Provider.CreateQuery<IList<TSource>>(
1082 Expression.Call(
1083 null,
1084 #if CRIPPLED_REFLECTION
1085 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int), default(IScheduler))),
1086 #else
1087 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1088 #endif
1089 source.Expression,
1090 Expression.Constant(timeSpan, typeof(TimeSpan)),
1091 Expression.Constant(count, typeof(int)),
1092 Expression.Constant(scheduler, typeof(IScheduler))
1093 )
1094 );
1095 }
1096
1097 /// <summary>
1098 /// Projects each element of an observable sequence into consecutive non-overlapping buffers which are produced based on timing information, using the specified scheduler to run timers.
1099 /// </summary>
1100 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1101 /// <param name="source">Source sequence to produce buffers over.</param>
1102 /// <param name="timeSpan">Length of each buffer.</param>
1103 /// <param name="scheduler">Scheduler to run buffering timers on.</param>
1104 /// <returns>An observable sequence of buffers.</returns>
1105 /// <exception cref="T:System.ArgumentNullException">
1106 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
1107 /// <exception cref="T:System.ArgumentOutOfRangeException">
1108 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
1109 /// <remarks>
1110 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
1111 /// Because all source sequence elements end up in one of the buffers, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced
1112 /// by the scheduler, where the action to close the current buffer and to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
1113 /// </remarks>
1114 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
1115 {
1116 if (source == null)
1117 throw new ArgumentNullException("source");
1118 if (scheduler == null)
1119 throw new ArgumentNullException("scheduler");
1120
1121 return source.Provider.CreateQuery<IList<TSource>>(
1122 Expression.Call(
1123 null,
1124 #if CRIPPLED_REFLECTION
1125 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
1126 #else
1127 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1128 #endif
1129 source.Expression,
1130 Expression.Constant(timeSpan, typeof(TimeSpan)),
1131 Expression.Constant(scheduler, typeof(IScheduler))
1132 )
1133 );
1134 }
1135
1136 /// <summary>
1137 /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
1138 /// </summary>
1139 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1140 /// <param name="source">Source sequence to produce buffers over.</param>
1141 /// <param name="timeSpan">Length of each buffer.</param>
1142 /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
1143 /// <returns>An observable sequence of buffers.</returns>
1144 /// <exception cref="T:System.ArgumentNullException">
1145 /// <paramref name="source" /> is null.</exception>
1146 /// <exception cref="T:System.ArgumentOutOfRangeException">
1147 /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
1148 /// <remarks>
1149 /// <para>
1150 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers with minimum duration
1151 /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
1152 /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
1153 /// </para>
1154 /// <para>
1155 /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
1156 /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
1157 /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
1158 /// </para>
1159 /// </remarks>
1160 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
1161 {
1162 if (source == null)
1163 throw new ArgumentNullException("source");
1164
1165 return source.Provider.CreateQuery<IList<TSource>>(
1166 Expression.Call(
1167 null,
1168 #if CRIPPLED_REFLECTION
1169 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan))),
1170 #else
1171 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1172 #endif
1173 source.Expression,
1174 Expression.Constant(timeSpan, typeof(TimeSpan)),
1175 Expression.Constant(timeShift, typeof(TimeSpan))
1176 )
1177 );
1178 }
1179
1180 /// <summary>
1181 /// Projects each element of an observable sequence into zero or more buffers which are produced based on timing information, using the specified scheduler to run timers.
1182 /// </summary>
1183 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1184 /// <param name="source">Source sequence to produce buffers over.</param>
1185 /// <param name="timeSpan">Length of each buffer.</param>
1186 /// <param name="timeShift">Interval between creation of consecutive buffers.</param>
1187 /// <param name="scheduler">Scheduler to run buffering timers on.</param>
1188 /// <returns>An observable sequence of buffers.</returns>
1189 /// <exception cref="T:System.ArgumentNullException">
1190 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
1191 /// <exception cref="T:System.ArgumentOutOfRangeException">
1192 /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
1193 /// <remarks>
1194 /// <para>
1195 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create buffers with minimum duration
1196 /// length. However, some buffers won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
1197 /// current buffer may not execute immediately, despite the TimeSpan.Zero due time.
1198 /// </para>
1199 /// <para>
1200 /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create buffers as fast as it can.
1201 /// However, this doesn't mean all buffers will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
1202 /// where the action to create a new buffer may not execute immediately, despite the TimeSpan.Zero due time.
1203 /// </para>
1204 /// </remarks>
1205 public static IQbservable<IList<TSource>> Buffer<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
1206 {
1207 if (source == null)
1208 throw new ArgumentNullException("source");
1209 if (scheduler == null)
1210 throw new ArgumentNullException("scheduler");
1211
1212 return source.Provider.CreateQuery<IList<TSource>>(
1213 Expression.Call(
1214 null,
1215 #if CRIPPLED_REFLECTION
1216 InfoOf(() => Qbservable.Buffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan), default(IScheduler))),
1217 #else
1218 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1219 #endif
1220 source.Expression,
1221 Expression.Constant(timeSpan, typeof(TimeSpan)),
1222 Expression.Constant(timeShift, typeof(TimeSpan)),
1223 Expression.Constant(scheduler, typeof(IScheduler))
1224 )
1225 );
1226 }
1227
1228 /// <summary>
1229 /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
1230 /// </summary>
1231 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1232 /// <typeparam name="TBufferBoundary">The type of the elements in the sequences indicating buffer boundary events.</typeparam>
1233 /// <param name="source">Source sequence to produce buffers over.</param>
1234 /// <param name="bufferBoundaries">Sequence of buffer boundary markers. The current buffer is closed and a new buffer is opened upon receiving a boundary marker.</param>
1235 /// <returns>An observable sequence of buffers.</returns>
1236 /// <exception cref="T:System.ArgumentNullException">
1237 /// <paramref name="source" /> or <paramref name="bufferBoundaries" /> is null.</exception>
1238 public static IQbservable<IList<TSource>> Buffer<TSource, TBufferBoundary>(this IQbservable<TSource> source, IObservable<TBufferBoundary> bufferBoundaries)
1239 {
1240 if (source == null)
1241 throw new ArgumentNullException("source");
1242 if (bufferBoundaries == null)
1243 throw new ArgumentNullException("bufferBoundaries");
1244
1245 return source.Provider.CreateQuery<IList<TSource>>(
1246 Expression.Call(
1247 null,
1248 #if CRIPPLED_REFLECTION
1249 InfoOf(() => Qbservable.Buffer<TSource, TBufferBoundary>(default(IQbservable<TSource>), default(IObservable<TBufferBoundary>))),
1250 #else
1251 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferBoundary)),
1252 #endif
1253 source.Expression,
1254 GetSourceExpression(bufferBoundaries)
1255 )
1256 );
1257 }
1258
1259 /// <summary>
1260 /// Projects each element of an observable sequence into consecutive non-overlapping buffers.
1261 /// </summary>
1262 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1263 /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
1264 /// <param name="source">Source sequence to produce buffers over.</param>
1265 /// <param name="bufferClosingSelector">A function invoked to define the boundaries of the produced buffers. A new buffer is started when the previous one is closed.</param>
1266 /// <returns>An observable sequence of buffers.</returns>
1267 /// <exception cref="T:System.ArgumentNullException">
1268 /// <paramref name="source" /> or <paramref name="bufferClosingSelector" /> is null.</exception>
1269 public static IQbservable<IList<TSource>> Buffer<TSource, TBufferClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TBufferClosing>>> bufferClosingSelector)
1270 {
1271 if (source == null)
1272 throw new ArgumentNullException("source");
1273 if (bufferClosingSelector == null)
1274 throw new ArgumentNullException("bufferClosingSelector");
1275
1276 return source.Provider.CreateQuery<IList<TSource>>(
1277 Expression.Call(
1278 null,
1279 #if CRIPPLED_REFLECTION
1280 InfoOf(() => Qbservable.Buffer<TSource, TBufferClosing>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TBufferClosing>>>))),
1281 #else
1282 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferClosing)),
1283 #endif
1284 source.Expression,
1285 bufferClosingSelector
1286 )
1287 );
1288 }
1289
1290 /// <summary>
1291 /// Projects each element of an observable sequence into zero or more buffers.
1292 /// </summary>
1293 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the lists in the result sequence.</typeparam>
1294 /// <typeparam name="TBufferOpening">The type of the elements in the sequence indicating buffer opening events, also passed to the closing selector to obtain a sequence of buffer closing events.</typeparam>
1295 /// <typeparam name="TBufferClosing">The type of the elements in the sequences indicating buffer closing events.</typeparam>
1296 /// <param name="source">Source sequence to produce buffers over.</param>
1297 /// <param name="bufferOpenings">Observable sequence whose elements denote the creation of new buffers.</param>
1298 /// <param name="bufferClosingSelector">A function invoked to define the closing of each produced buffer.</param>
1299 /// <returns>An observable sequence of buffers.</returns>
1300 /// <exception cref="T:System.ArgumentNullException">
1301 /// <paramref name="source" /> or <paramref name="bufferOpenings" /> or <paramref name="bufferClosingSelector" /> is null.</exception>
1302 public static IQbservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(this IQbservable<TSource> source, IObservable<TBufferOpening> bufferOpenings, Expression<Func<TBufferOpening, IObservable<TBufferClosing>>> bufferClosingSelector)
1303 {
1304 if (source == null)
1305 throw new ArgumentNullException("source");
1306 if (bufferOpenings == null)
1307 throw new ArgumentNullException("bufferOpenings");
1308 if (bufferClosingSelector == null)
1309 throw new ArgumentNullException("bufferClosingSelector");
1310
1311 return source.Provider.CreateQuery<IList<TSource>>(
1312 Expression.Call(
1313 null,
1314 #if CRIPPLED_REFLECTION
1315 InfoOf(() => Qbservable.Buffer<TSource, TBufferOpening, TBufferClosing>(default(IQbservable<TSource>), default(IObservable<TBufferOpening>), default(Expression<Func<TBufferOpening, IObservable<TBufferClosing>>>))),
1316 #else
1317 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TBufferOpening), typeof(TBufferClosing)),
1318 #endif
1319 source.Expression,
1320 GetSourceExpression(bufferOpenings),
1321 bufferClosingSelector
1322 )
1323 );
1324 }
1325
1326 /// <summary>
1327 /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing an empty sequence if no match is found.
1328 /// </summary>
1329 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1330 /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
1331 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
1332 /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
1333 /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
1334 /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or an empty sequence if no match is found.</returns>
1335 /// <exception cref="T:System.ArgumentNullException">
1336 /// <paramref name="selector" /> or <paramref name="sources" /> is null.</exception>
1337 public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources)
1338 {
1339 if (provider == null)
1340 throw new ArgumentNullException("provider");
1341 if (selector == null)
1342 throw new ArgumentNullException("selector");
1343 if (sources == null)
1344 throw new ArgumentNullException("sources");
1345
1346 return provider.CreateQuery<TResult>(
1347 Expression.Call(
1348 null,
1349 #if CRIPPLED_REFLECTION
1350 InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>))),
1351 #else
1352 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
1353 #endif
1354 Expression.Constant(provider, typeof(IQbservableProvider)),
1355 selector,
1356 Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>))
1357 )
1358 );
1359 }
1360
1361 /// <summary>
1362 /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing <paramref name="defaultSource" /> if no match is found.
1363 /// </summary>
1364 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1365 /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
1366 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
1367 /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
1368 /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
1369 /// <param name="defaultSource">Default source to select in case no matching source in <paramref name="sources" /> is found.</param>
1370 /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or <paramref name="defaultSource" /> if no match is found.</returns>
1371 /// <exception cref="T:System.ArgumentNullException">
1372 /// <paramref name="selector" /> or <paramref name="sources" /> or <paramref name="defaultSource" /> is null.</exception>
1373 public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources, IObservable<TResult> defaultSource)
1374 {
1375 if (provider == null)
1376 throw new ArgumentNullException("provider");
1377 if (selector == null)
1378 throw new ArgumentNullException("selector");
1379 if (sources == null)
1380 throw new ArgumentNullException("sources");
1381 if (defaultSource == null)
1382 throw new ArgumentNullException("defaultSource");
1383
1384 return provider.CreateQuery<TResult>(
1385 Expression.Call(
1386 null,
1387 #if CRIPPLED_REFLECTION
1388 InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>), default(IObservable<TResult>))),
1389 #else
1390 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
1391 #endif
1392 Expression.Constant(provider, typeof(IQbservableProvider)),
1393 selector,
1394 Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>)),
1395 GetSourceExpression(defaultSource)
1396 )
1397 );
1398 }
1399
1400 /// <summary>
1401 /// Uses <paramref name="selector" /> to determine which source in <paramref name="sources" /> to return, choosing an empty sequence on the specified scheduler if no match is found.
1402 /// </summary>
1403 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1404 /// <typeparam name="TValue">The type of the value returned by the selector function, used to look up the resulting source.</typeparam>
1405 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
1406 /// <param name="selector">Selector function invoked to determine the source to lookup in the <paramref name="sources" /> dictionary.</param>
1407 /// <param name="sources">Dictionary of sources to select from based on the <paramref name="selector" /> invocation result.</param>
1408 /// <param name="scheduler">Scheduler to generate an empty sequence on in case no matching source in <paramref name="sources" /> is found.</param>
1409 /// <returns>The observable sequence retrieved from the <paramref name="sources" /> dictionary based on the <paramref name="selector" /> invocation result, or an empty sequence if no match is found.</returns>
1410 /// <exception cref="T:System.ArgumentNullException">
1411 /// <paramref name="selector" /> or <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
1412 public static IQbservable<TResult> Case<TValue, TResult>(this IQbservableProvider provider, Expression<Func<TValue>> selector, IDictionary<TValue, IObservable<TResult>> sources, IScheduler scheduler)
1413 {
1414 if (provider == null)
1415 throw new ArgumentNullException("provider");
1416 if (selector == null)
1417 throw new ArgumentNullException("selector");
1418 if (sources == null)
1419 throw new ArgumentNullException("sources");
1420 if (scheduler == null)
1421 throw new ArgumentNullException("scheduler");
1422
1423 return provider.CreateQuery<TResult>(
1424 Expression.Call(
1425 null,
1426 #if CRIPPLED_REFLECTION
1427 InfoOf(() => Qbservable.Case<TValue, TResult>(default(IQbservableProvider), default(Expression<Func<TValue>>), default(IDictionary<TValue, IObservable<TResult>>), default(IScheduler))),
1428 #else
1429 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)),
1430 #endif
1431 Expression.Constant(provider, typeof(IQbservableProvider)),
1432 selector,
1433 Expression.Constant(sources, typeof(IDictionary<TValue, IObservable<TResult>>)),
1434 Expression.Constant(scheduler, typeof(IScheduler))
1435 )
1436 );
1437 }
1438
1439 /// <summary>
1440 /// Converts the elements of an observable sequence to the specified type.
1441 /// </summary>
1442 /// <typeparam name="TResult">The type to convert the elements in the source sequence to.</typeparam>
1443 /// <param name="source">The observable sequence that contains the elements to be converted.</param>
1444 /// <returns>An observable sequence that contains each element of the source sequence converted to the specified type.</returns>
1445 /// <exception cref="T:System.ArgumentNullException">
1446 /// <paramref name="source" /> is null.</exception>
1447 public static IQbservable<TResult> Cast<TResult>(this IQbservable<object> source)
1448 {
1449 if (source == null)
1450 throw new ArgumentNullException("source");
1451
1452 return source.Provider.CreateQuery<TResult>(
1453 Expression.Call(
1454 null,
1455 #if CRIPPLED_REFLECTION
1456 InfoOf(() => Qbservable.Cast<TResult>(default(IQbservable<object>))),
1457 #else
1458 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
1459 #endif
1460 source.Expression
1461 )
1462 );
1463 }
1464
1465 /// <summary>
1466 /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
1467 /// </summary>
1468 /// <typeparam name="TSource">The type of the elements in the source sequence and handler sequence.</typeparam>
1469 /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
1470 /// <param name="second">Second observable sequence used to produce results when an error occurred in the first sequence.</param>
1471 /// <returns>An observable sequence containing the first sequence's elements, followed by the elements of the second sequence in case an exception occurred.</returns>
1472 /// <exception cref="T:System.ArgumentNullException">
1473 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
1474 public static IQbservable<TSource> Catch<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
1475 {
1476 if (first == null)
1477 throw new ArgumentNullException("first");
1478 if (second == null)
1479 throw new ArgumentNullException("second");
1480
1481 return first.Provider.CreateQuery<TSource>(
1482 Expression.Call(
1483 null,
1484 #if CRIPPLED_REFLECTION
1485 InfoOf(() => Qbservable.Catch<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
1486 #else
1487 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1488 #endif
1489 first.Expression,
1490 GetSourceExpression(second)
1491 )
1492 );
1493 }
1494
1495 /// <summary>
1496 /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
1497 /// </summary>
1498 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1499 /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
1500 /// <param name="sources">Observable sequences to catch exceptions for.</param>
1501 /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
1502 /// <exception cref="T:System.ArgumentNullException">
1503 /// <paramref name="sources" /> is null.</exception>
1504 public static IQbservable<TSource> Catch<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
1505 {
1506 if (provider == null)
1507 throw new ArgumentNullException("provider");
1508 if (sources == null)
1509 throw new ArgumentNullException("sources");
1510
1511 return provider.CreateQuery<TSource>(
1512 Expression.Call(
1513 null,
1514 #if CRIPPLED_REFLECTION
1515 InfoOf(() => Qbservable.Catch<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
1516 #else
1517 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1518 #endif
1519 Expression.Constant(provider, typeof(IQbservableProvider)),
1520 GetSourceExpression(sources)
1521 )
1522 );
1523 }
1524
1525 /// <summary>
1526 /// Continues an observable sequence that is terminated by an exception with the next observable sequence.
1527 /// </summary>
1528 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1529 /// <typeparam name="TSource">The type of the elements in the source and handler sequences.</typeparam>
1530 /// <param name="sources">Observable sequences to catch exceptions for.</param>
1531 /// <returns>An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.</returns>
1532 /// <exception cref="T:System.ArgumentNullException">
1533 /// <paramref name="sources" /> is null.</exception>
1534 public static IQbservable<TSource> Catch<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
1535 {
1536 if (provider == null)
1537 throw new ArgumentNullException("provider");
1538 if (sources == null)
1539 throw new ArgumentNullException("sources");
1540
1541 return provider.CreateQuery<TSource>(
1542 Expression.Call(
1543 null,
1544 #if CRIPPLED_REFLECTION
1545 InfoOf(() => Qbservable.Catch<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
1546 #else
1547 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1548 #endif
1549 Expression.Constant(provider, typeof(IQbservableProvider)),
1550 GetSourceExpression(sources)
1551 )
1552 );
1553 }
1554
1555 /// <summary>
1556 /// Continues an observable sequence that is terminated by an exception of the specified type with the observable sequence produced by the handler.
1557 /// </summary>
1558 /// <typeparam name="TSource">The type of the elements in the source sequence and sequences returned by the exception handler function.</typeparam>
1559 /// <typeparam name="TException">The type of the exception to catch and handle. Needs to derive from <see cref="T:System.Exception" />.</typeparam>
1560 /// <param name="source">Source sequence.</param>
1561 /// <param name="handler">Exception handler function, producing another observable sequence.</param>
1562 /// <returns>An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an exception occurred.</returns>
1563 /// <exception cref="T:System.ArgumentNullException">
1564 /// <paramref name="source" /> or <paramref name="handler" /> is null.</exception>
1565 public static IQbservable<TSource> Catch<TSource, TException>(this IQbservable<TSource> source, Expression<Func<TException, IObservable<TSource>>> handler)
1566 where TException : Exception
1567 {
1568 if (source == null)
1569 throw new ArgumentNullException("source");
1570 if (handler == null)
1571 throw new ArgumentNullException("handler");
1572
1573 return source.Provider.CreateQuery<TSource>(
1574 Expression.Call(
1575 null,
1576 #if CRIPPLED_REFLECTION
1577 InfoOf(() => Qbservable.Catch<TSource, TException>(default(IQbservable<TSource>), default(Expression<Func<TException, IObservable<TSource>>>))),
1578 #else
1579 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)),
1580 #endif
1581 source.Expression,
1582 handler
1583 )
1584 );
1585 }
1586
1587 /// <summary>
1588 /// Produces an enumerable sequence of consecutive (possibly empty) chunks of the source sequence.
1589 /// </summary>
1590 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
1591 /// <param name="source">Source observable sequence.</param>
1592 /// <returns>The enumerable sequence that returns consecutive (possibly empty) chunks upon each iteration.</returns>
1593 /// <exception cref="T:System.ArgumentNullException">
1594 /// <paramref name="source" /> is null.</exception>
1595 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
1596 public static IQueryable<IList<TSource>> Chunkify<TSource>(this IQbservable<TSource> source)
1597 {
1598 if (source == null)
1599 throw new ArgumentNullException("source");
1600
1601 return ((IQueryProvider)source.Provider).CreateQuery<IList<TSource>>(
1602 Expression.Call(
1603 null,
1604 #if CRIPPLED_REFLECTION
1605 InfoOf(() => Qbservable.Chunkify<TSource>(default(IQbservable<TSource>))),
1606 #else
1607 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1608 #endif
1609 source.Expression
1610 )
1611 );
1612 }
1613
1614 /// <summary>
1615 /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
1616 /// </summary>
1617 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
1618 /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
1619 /// <param name="source">Source observable sequence.</param>
1620 /// <param name="getInitialCollector">Factory to create the initial collector object.</param>
1621 /// <param name="merge">Merges a sequence element with the current collector.</param>
1622 /// <param name="getNewCollector">Factory to replace the current collector by a new collector.</param>
1623 /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
1624 /// <exception cref="T:System.ArgumentNullException">
1625 /// <paramref name="source" /> or <paramref name="getInitialCollector" /> or <paramref name="merge" /> or <paramref name="getNewCollector" /> is null.</exception>
1626 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
1627 public static IQueryable<TResult> Collect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TResult>> getInitialCollector, Expression<Func<TResult, TSource, TResult>> merge, Expression<Func<TResult, TResult>> getNewCollector)
1628 {
1629 if (source == null)
1630 throw new ArgumentNullException("source");
1631 if (getInitialCollector == null)
1632 throw new ArgumentNullException("getInitialCollector");
1633 if (merge == null)
1634 throw new ArgumentNullException("merge");
1635 if (getNewCollector == null)
1636 throw new ArgumentNullException("getNewCollector");
1637
1638 return ((IQueryProvider)source.Provider).CreateQuery<TResult>(
1639 Expression.Call(
1640 null,
1641 #if CRIPPLED_REFLECTION
1642 InfoOf(() => Qbservable.Collect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TResult>>), default(Expression<Func<TResult, TSource, TResult>>), default(Expression<Func<TResult, TResult>>))),
1643 #else
1644 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
1645 #endif
1646 source.Expression,
1647 getInitialCollector,
1648 merge,
1649 getNewCollector
1650 )
1651 );
1652 }
1653
1654 /// <summary>
1655 /// Produces an enumerable sequence that returns elements collected/aggregated from the source sequence between consecutive iterations.
1656 /// </summary>
1657 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
1658 /// <typeparam name="TResult">The type of the elements produced by the merge operation during collection.</typeparam>
1659 /// <param name="source">Source observable sequence.</param>
1660 /// <param name="newCollector">Factory to create a new collector object.</param>
1661 /// <param name="merge">Merges a sequence element with the current collector.</param>
1662 /// <returns>The enumerable sequence that returns collected/aggregated elements from the source sequence upon each iteration.</returns>
1663 /// <exception cref="T:System.ArgumentNullException">
1664 /// <paramref name="source" /> or <paramref name="newCollector" /> or <paramref name="merge" /> is null.</exception>
1665 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
1666 public static IQueryable<TResult> Collect<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TResult>> newCollector, Expression<Func<TResult, TSource, TResult>> merge)
1667 {
1668 if (source == null)
1669 throw new ArgumentNullException("source");
1670 if (newCollector == null)
1671 throw new ArgumentNullException("newCollector");
1672 if (merge == null)
1673 throw new ArgumentNullException("merge");
1674
1675 return ((IQueryProvider)source.Provider).CreateQuery<TResult>(
1676 Expression.Call(
1677 null,
1678 #if CRIPPLED_REFLECTION
1679 InfoOf(() => Qbservable.Collect<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TResult>>), default(Expression<Func<TResult, TSource, TResult>>))),
1680 #else
1681 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
1682 #endif
1683 source.Expression,
1684 newCollector,
1685 merge
1686 )
1687 );
1688 }
1689
1690 /// <summary>
1691 /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
1692 /// </summary>
1693 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1694 /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
1695 /// <param name="sources">Observable sources.</param>
1696 /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
1697 /// <exception cref="T:System.ArgumentNullException">
1698 /// <paramref name="sources" /> is null.</exception>
1699 public static IQbservable<IList<TSource>> CombineLatest<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
1700 {
1701 if (provider == null)
1702 throw new ArgumentNullException("provider");
1703 if (sources == null)
1704 throw new ArgumentNullException("sources");
1705
1706 return provider.CreateQuery<IList<TSource>>(
1707 Expression.Call(
1708 null,
1709 #if CRIPPLED_REFLECTION
1710 InfoOf(() => Qbservable.CombineLatest<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
1711 #else
1712 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1713 #endif
1714 Expression.Constant(provider, typeof(IQbservableProvider)),
1715 GetSourceExpression(sources)
1716 )
1717 );
1718 }
1719
1720 /// <summary>
1721 /// Merges the specified observable sequences into one observable sequence by emitting a list with the latest source elements whenever any of the observable sequences produces an element.
1722 /// </summary>
1723 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1724 /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
1725 /// <param name="sources">Observable sources.</param>
1726 /// <returns>An observable sequence containing lists of the latest elements of the sources.</returns>
1727 /// <exception cref="T:System.ArgumentNullException">
1728 /// <paramref name="sources" /> is null.</exception>
1729 public static IQbservable<IList<TSource>> CombineLatest<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
1730 {
1731 if (provider == null)
1732 throw new ArgumentNullException("provider");
1733 if (sources == null)
1734 throw new ArgumentNullException("sources");
1735
1736 return provider.CreateQuery<IList<TSource>>(
1737 Expression.Call(
1738 null,
1739 #if CRIPPLED_REFLECTION
1740 InfoOf(() => Qbservable.CombineLatest<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
1741 #else
1742 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
1743 #endif
1744 Expression.Constant(provider, typeof(IQbservableProvider)),
1745 GetSourceExpression(sources)
1746 )
1747 );
1748 }
1749
1750 /// <summary>
1751 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
1752 /// </summary>
1753 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
1754 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
1755 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1756 /// <param name="sources">Observable sources.</param>
1757 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element. For efficiency, the input list is reused after the selector returns. Either aggregate or copy the values during the function call.</param>
1758 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
1759 /// <exception cref="T:System.ArgumentNullException">
1760 /// <paramref name="sources" /> or <paramref name="resultSelector" /> is null.</exception>
1761 public static IQbservable<TResult> CombineLatest<TSource, TResult>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, Expression<Func<IList<TSource>, TResult>> resultSelector)
1762 {
1763 if (provider == null)
1764 throw new ArgumentNullException("provider");
1765 if (sources == null)
1766 throw new ArgumentNullException("sources");
1767 if (resultSelector == null)
1768 throw new ArgumentNullException("resultSelector");
1769
1770 return provider.CreateQuery<TResult>(
1771 Expression.Call(
1772 null,
1773 #if CRIPPLED_REFLECTION
1774 InfoOf(() => Qbservable.CombineLatest<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(Expression<Func<IList<TSource>, TResult>>))),
1775 #else
1776 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
1777 #endif
1778 Expression.Constant(provider, typeof(IQbservableProvider)),
1779 GetSourceExpression(sources),
1780 resultSelector
1781 )
1782 );
1783 }
1784
1785 /// <summary>
1786 /// Merges two observable sequences into one observable sequence by using the selector function whenever one of the observable sequences produces an element.
1787 /// </summary>
1788 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
1789 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
1790 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1791 /// <param name="first">First observable source.</param>
1792 /// <param name="second">Second observable source.</param>
1793 /// <param name="resultSelector">Function to invoke whenever either of the sources produces an element.</param>
1794 /// <returns>An observable sequence containing the result of combining elements of both sources using the specified result selector function.</returns>
1795 /// <exception cref="T:System.ArgumentNullException">
1796 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
1797 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
1798 {
1799 if (first == null)
1800 throw new ArgumentNullException("first");
1801 if (second == null)
1802 throw new ArgumentNullException("second");
1803 if (resultSelector == null)
1804 throw new ArgumentNullException("resultSelector");
1805
1806 return first.Provider.CreateQuery<TResult>(
1807 Expression.Call(
1808 null,
1809 #if CRIPPLED_REFLECTION
1810 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
1811 #else
1812 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
1813 #endif
1814 first.Expression,
1815 GetSourceExpression(second),
1816 resultSelector
1817 )
1818 );
1819 }
1820
1821 /// <summary>
1822 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
1823 /// </summary>
1824 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
1825 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
1826 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
1827 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1828 /// <param name="source1">First observable source.</param>
1829 /// <param name="source2">Second observable source.</param>
1830 /// <param name="source3">Third observable source.</param>
1831 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
1832 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
1833 /// <exception cref="T:System.ArgumentNullException">
1834 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="resultSelector" /> is null.</exception>
1835 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Expression<Func<TSource1, TSource2, TSource3, TResult>> resultSelector)
1836 {
1837 if (source1 == null)
1838 throw new ArgumentNullException("source1");
1839 if (source2 == null)
1840 throw new ArgumentNullException("source2");
1841 if (source3 == null)
1842 throw new ArgumentNullException("source3");
1843 if (resultSelector == null)
1844 throw new ArgumentNullException("resultSelector");
1845
1846 return source1.Provider.CreateQuery<TResult>(
1847 Expression.Call(
1848 null,
1849 #if CRIPPLED_REFLECTION
1850 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(Expression<Func<TSource1, TSource2, TSource3, TResult>>))),
1851 #else
1852 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TResult)),
1853 #endif
1854 source1.Expression,
1855 GetSourceExpression(source2),
1856 GetSourceExpression(source3),
1857 resultSelector
1858 )
1859 );
1860 }
1861
1862 /// <summary>
1863 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
1864 /// </summary>
1865 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
1866 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
1867 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
1868 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
1869 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1870 /// <param name="source1">First observable source.</param>
1871 /// <param name="source2">Second observable source.</param>
1872 /// <param name="source3">Third observable source.</param>
1873 /// <param name="source4">Fourth observable source.</param>
1874 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
1875 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
1876 /// <exception cref="T:System.ArgumentNullException">
1877 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="resultSelector" /> is null.</exception>
1878 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>> resultSelector)
1879 {
1880 if (source1 == null)
1881 throw new ArgumentNullException("source1");
1882 if (source2 == null)
1883 throw new ArgumentNullException("source2");
1884 if (source3 == null)
1885 throw new ArgumentNullException("source3");
1886 if (source4 == null)
1887 throw new ArgumentNullException("source4");
1888 if (resultSelector == null)
1889 throw new ArgumentNullException("resultSelector");
1890
1891 return source1.Provider.CreateQuery<TResult>(
1892 Expression.Call(
1893 null,
1894 #if CRIPPLED_REFLECTION
1895 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>>))),
1896 #else
1897 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TResult)),
1898 #endif
1899 source1.Expression,
1900 GetSourceExpression(source2),
1901 GetSourceExpression(source3),
1902 GetSourceExpression(source4),
1903 resultSelector
1904 )
1905 );
1906 }
1907
1908 #if !NO_LARGEARITY
1909 /// <summary>
1910 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
1911 /// </summary>
1912 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
1913 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
1914 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
1915 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
1916 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
1917 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1918 /// <param name="source1">First observable source.</param>
1919 /// <param name="source2">Second observable source.</param>
1920 /// <param name="source3">Third observable source.</param>
1921 /// <param name="source4">Fourth observable source.</param>
1922 /// <param name="source5">Fifth observable source.</param>
1923 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
1924 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
1925 /// <exception cref="T:System.ArgumentNullException">
1926 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="resultSelector" /> is null.</exception>
1927 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>> resultSelector)
1928 {
1929 if (source1 == null)
1930 throw new ArgumentNullException("source1");
1931 if (source2 == null)
1932 throw new ArgumentNullException("source2");
1933 if (source3 == null)
1934 throw new ArgumentNullException("source3");
1935 if (source4 == null)
1936 throw new ArgumentNullException("source4");
1937 if (source5 == null)
1938 throw new ArgumentNullException("source5");
1939 if (resultSelector == null)
1940 throw new ArgumentNullException("resultSelector");
1941
1942 return source1.Provider.CreateQuery<TResult>(
1943 Expression.Call(
1944 null,
1945 #if CRIPPLED_REFLECTION
1946 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>>))),
1947 #else
1948 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TResult)),
1949 #endif
1950 source1.Expression,
1951 GetSourceExpression(source2),
1952 GetSourceExpression(source3),
1953 GetSourceExpression(source4),
1954 GetSourceExpression(source5),
1955 resultSelector
1956 )
1957 );
1958 }
1959 #endif
1960
1961 #if !NO_LARGEARITY
1962 /// <summary>
1963 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
1964 /// </summary>
1965 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
1966 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
1967 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
1968 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
1969 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
1970 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
1971 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
1972 /// <param name="source1">First observable source.</param>
1973 /// <param name="source2">Second observable source.</param>
1974 /// <param name="source3">Third observable source.</param>
1975 /// <param name="source4">Fourth observable source.</param>
1976 /// <param name="source5">Fifth observable source.</param>
1977 /// <param name="source6">Sixth observable source.</param>
1978 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
1979 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
1980 /// <exception cref="T:System.ArgumentNullException">
1981 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="resultSelector" /> is null.</exception>
1982 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>> resultSelector)
1983 {
1984 if (source1 == null)
1985 throw new ArgumentNullException("source1");
1986 if (source2 == null)
1987 throw new ArgumentNullException("source2");
1988 if (source3 == null)
1989 throw new ArgumentNullException("source3");
1990 if (source4 == null)
1991 throw new ArgumentNullException("source4");
1992 if (source5 == null)
1993 throw new ArgumentNullException("source5");
1994 if (source6 == null)
1995 throw new ArgumentNullException("source6");
1996 if (resultSelector == null)
1997 throw new ArgumentNullException("resultSelector");
1998
1999 return source1.Provider.CreateQuery<TResult>(
2000 Expression.Call(
2001 null,
2002 #if CRIPPLED_REFLECTION
2003 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>>))),
2004 #else
2005 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TResult)),
2006 #endif
2007 source1.Expression,
2008 GetSourceExpression(source2),
2009 GetSourceExpression(source3),
2010 GetSourceExpression(source4),
2011 GetSourceExpression(source5),
2012 GetSourceExpression(source6),
2013 resultSelector
2014 )
2015 );
2016 }
2017 #endif
2018
2019 #if !NO_LARGEARITY
2020 /// <summary>
2021 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2022 /// </summary>
2023 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2024 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2025 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2026 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2027 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2028 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2029 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2030 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2031 /// <param name="source1">First observable source.</param>
2032 /// <param name="source2">Second observable source.</param>
2033 /// <param name="source3">Third observable source.</param>
2034 /// <param name="source4">Fourth observable source.</param>
2035 /// <param name="source5">Fifth observable source.</param>
2036 /// <param name="source6">Sixth observable source.</param>
2037 /// <param name="source7">Seventh observable source.</param>
2038 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2039 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2040 /// <exception cref="T:System.ArgumentNullException">
2041 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="resultSelector" /> is null.</exception>
2042 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>> resultSelector)
2043 {
2044 if (source1 == null)
2045 throw new ArgumentNullException("source1");
2046 if (source2 == null)
2047 throw new ArgumentNullException("source2");
2048 if (source3 == null)
2049 throw new ArgumentNullException("source3");
2050 if (source4 == null)
2051 throw new ArgumentNullException("source4");
2052 if (source5 == null)
2053 throw new ArgumentNullException("source5");
2054 if (source6 == null)
2055 throw new ArgumentNullException("source6");
2056 if (source7 == null)
2057 throw new ArgumentNullException("source7");
2058 if (resultSelector == null)
2059 throw new ArgumentNullException("resultSelector");
2060
2061 return source1.Provider.CreateQuery<TResult>(
2062 Expression.Call(
2063 null,
2064 #if CRIPPLED_REFLECTION
2065 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>>))),
2066 #else
2067 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TResult)),
2068 #endif
2069 source1.Expression,
2070 GetSourceExpression(source2),
2071 GetSourceExpression(source3),
2072 GetSourceExpression(source4),
2073 GetSourceExpression(source5),
2074 GetSourceExpression(source6),
2075 GetSourceExpression(source7),
2076 resultSelector
2077 )
2078 );
2079 }
2080 #endif
2081
2082 #if !NO_LARGEARITY
2083 /// <summary>
2084 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2085 /// </summary>
2086 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2087 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2088 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2089 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2090 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2091 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2092 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2093 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2094 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2095 /// <param name="source1">First observable source.</param>
2096 /// <param name="source2">Second observable source.</param>
2097 /// <param name="source3">Third observable source.</param>
2098 /// <param name="source4">Fourth observable source.</param>
2099 /// <param name="source5">Fifth observable source.</param>
2100 /// <param name="source6">Sixth observable source.</param>
2101 /// <param name="source7">Seventh observable source.</param>
2102 /// <param name="source8">Eighth observable source.</param>
2103 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2104 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2105 /// <exception cref="T:System.ArgumentNullException">
2106 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="resultSelector" /> is null.</exception>
2107 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>> resultSelector)
2108 {
2109 if (source1 == null)
2110 throw new ArgumentNullException("source1");
2111 if (source2 == null)
2112 throw new ArgumentNullException("source2");
2113 if (source3 == null)
2114 throw new ArgumentNullException("source3");
2115 if (source4 == null)
2116 throw new ArgumentNullException("source4");
2117 if (source5 == null)
2118 throw new ArgumentNullException("source5");
2119 if (source6 == null)
2120 throw new ArgumentNullException("source6");
2121 if (source7 == null)
2122 throw new ArgumentNullException("source7");
2123 if (source8 == null)
2124 throw new ArgumentNullException("source8");
2125 if (resultSelector == null)
2126 throw new ArgumentNullException("resultSelector");
2127
2128 return source1.Provider.CreateQuery<TResult>(
2129 Expression.Call(
2130 null,
2131 #if CRIPPLED_REFLECTION
2132 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>>))),
2133 #else
2134 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TResult)),
2135 #endif
2136 source1.Expression,
2137 GetSourceExpression(source2),
2138 GetSourceExpression(source3),
2139 GetSourceExpression(source4),
2140 GetSourceExpression(source5),
2141 GetSourceExpression(source6),
2142 GetSourceExpression(source7),
2143 GetSourceExpression(source8),
2144 resultSelector
2145 )
2146 );
2147 }
2148 #endif
2149
2150 #if !NO_LARGEARITY
2151 /// <summary>
2152 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2153 /// </summary>
2154 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2155 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2156 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2157 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2158 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2159 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2160 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2161 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2162 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2163 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2164 /// <param name="source1">First observable source.</param>
2165 /// <param name="source2">Second observable source.</param>
2166 /// <param name="source3">Third observable source.</param>
2167 /// <param name="source4">Fourth observable source.</param>
2168 /// <param name="source5">Fifth observable source.</param>
2169 /// <param name="source6">Sixth observable source.</param>
2170 /// <param name="source7">Seventh observable source.</param>
2171 /// <param name="source8">Eighth observable source.</param>
2172 /// <param name="source9">Ninth observable source.</param>
2173 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2174 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2175 /// <exception cref="T:System.ArgumentNullException">
2176 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="resultSelector" /> is null.</exception>
2177 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>> resultSelector)
2178 {
2179 if (source1 == null)
2180 throw new ArgumentNullException("source1");
2181 if (source2 == null)
2182 throw new ArgumentNullException("source2");
2183 if (source3 == null)
2184 throw new ArgumentNullException("source3");
2185 if (source4 == null)
2186 throw new ArgumentNullException("source4");
2187 if (source5 == null)
2188 throw new ArgumentNullException("source5");
2189 if (source6 == null)
2190 throw new ArgumentNullException("source6");
2191 if (source7 == null)
2192 throw new ArgumentNullException("source7");
2193 if (source8 == null)
2194 throw new ArgumentNullException("source8");
2195 if (source9 == null)
2196 throw new ArgumentNullException("source9");
2197 if (resultSelector == null)
2198 throw new ArgumentNullException("resultSelector");
2199
2200 return source1.Provider.CreateQuery<TResult>(
2201 Expression.Call(
2202 null,
2203 #if CRIPPLED_REFLECTION
2204 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>>))),
2205 #else
2206 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TResult)),
2207 #endif
2208 source1.Expression,
2209 GetSourceExpression(source2),
2210 GetSourceExpression(source3),
2211 GetSourceExpression(source4),
2212 GetSourceExpression(source5),
2213 GetSourceExpression(source6),
2214 GetSourceExpression(source7),
2215 GetSourceExpression(source8),
2216 GetSourceExpression(source9),
2217 resultSelector
2218 )
2219 );
2220 }
2221 #endif
2222
2223 #if !NO_LARGEARITY
2224 /// <summary>
2225 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2226 /// </summary>
2227 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2228 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2229 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2230 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2231 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2232 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2233 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2234 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2235 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2236 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2237 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2238 /// <param name="source1">First observable source.</param>
2239 /// <param name="source2">Second observable source.</param>
2240 /// <param name="source3">Third observable source.</param>
2241 /// <param name="source4">Fourth observable source.</param>
2242 /// <param name="source5">Fifth observable source.</param>
2243 /// <param name="source6">Sixth observable source.</param>
2244 /// <param name="source7">Seventh observable source.</param>
2245 /// <param name="source8">Eighth observable source.</param>
2246 /// <param name="source9">Ninth observable source.</param>
2247 /// <param name="source10">Tenth observable source.</param>
2248 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2249 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2250 /// <exception cref="T:System.ArgumentNullException">
2251 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="resultSelector" /> is null.</exception>
2252 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>> resultSelector)
2253 {
2254 if (source1 == null)
2255 throw new ArgumentNullException("source1");
2256 if (source2 == null)
2257 throw new ArgumentNullException("source2");
2258 if (source3 == null)
2259 throw new ArgumentNullException("source3");
2260 if (source4 == null)
2261 throw new ArgumentNullException("source4");
2262 if (source5 == null)
2263 throw new ArgumentNullException("source5");
2264 if (source6 == null)
2265 throw new ArgumentNullException("source6");
2266 if (source7 == null)
2267 throw new ArgumentNullException("source7");
2268 if (source8 == null)
2269 throw new ArgumentNullException("source8");
2270 if (source9 == null)
2271 throw new ArgumentNullException("source9");
2272 if (source10 == null)
2273 throw new ArgumentNullException("source10");
2274 if (resultSelector == null)
2275 throw new ArgumentNullException("resultSelector");
2276
2277 return source1.Provider.CreateQuery<TResult>(
2278 Expression.Call(
2279 null,
2280 #if CRIPPLED_REFLECTION
2281 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>>))),
2282 #else
2283 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TResult)),
2284 #endif
2285 source1.Expression,
2286 GetSourceExpression(source2),
2287 GetSourceExpression(source3),
2288 GetSourceExpression(source4),
2289 GetSourceExpression(source5),
2290 GetSourceExpression(source6),
2291 GetSourceExpression(source7),
2292 GetSourceExpression(source8),
2293 GetSourceExpression(source9),
2294 GetSourceExpression(source10),
2295 resultSelector
2296 )
2297 );
2298 }
2299 #endif
2300
2301 #if !NO_LARGEARITY
2302 /// <summary>
2303 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2304 /// </summary>
2305 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2306 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2307 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2308 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2309 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2310 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2311 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2312 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2313 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2314 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2315 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2316 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2317 /// <param name="source1">First observable source.</param>
2318 /// <param name="source2">Second observable source.</param>
2319 /// <param name="source3">Third observable source.</param>
2320 /// <param name="source4">Fourth observable source.</param>
2321 /// <param name="source5">Fifth observable source.</param>
2322 /// <param name="source6">Sixth observable source.</param>
2323 /// <param name="source7">Seventh observable source.</param>
2324 /// <param name="source8">Eighth observable source.</param>
2325 /// <param name="source9">Ninth observable source.</param>
2326 /// <param name="source10">Tenth observable source.</param>
2327 /// <param name="source11">Eleventh observable source.</param>
2328 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2329 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2330 /// <exception cref="T:System.ArgumentNullException">
2331 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="resultSelector" /> is null.</exception>
2332 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>> resultSelector)
2333 {
2334 if (source1 == null)
2335 throw new ArgumentNullException("source1");
2336 if (source2 == null)
2337 throw new ArgumentNullException("source2");
2338 if (source3 == null)
2339 throw new ArgumentNullException("source3");
2340 if (source4 == null)
2341 throw new ArgumentNullException("source4");
2342 if (source5 == null)
2343 throw new ArgumentNullException("source5");
2344 if (source6 == null)
2345 throw new ArgumentNullException("source6");
2346 if (source7 == null)
2347 throw new ArgumentNullException("source7");
2348 if (source8 == null)
2349 throw new ArgumentNullException("source8");
2350 if (source9 == null)
2351 throw new ArgumentNullException("source9");
2352 if (source10 == null)
2353 throw new ArgumentNullException("source10");
2354 if (source11 == null)
2355 throw new ArgumentNullException("source11");
2356 if (resultSelector == null)
2357 throw new ArgumentNullException("resultSelector");
2358
2359 return source1.Provider.CreateQuery<TResult>(
2360 Expression.Call(
2361 null,
2362 #if CRIPPLED_REFLECTION
2363 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>>))),
2364 #else
2365 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TResult)),
2366 #endif
2367 source1.Expression,
2368 GetSourceExpression(source2),
2369 GetSourceExpression(source3),
2370 GetSourceExpression(source4),
2371 GetSourceExpression(source5),
2372 GetSourceExpression(source6),
2373 GetSourceExpression(source7),
2374 GetSourceExpression(source8),
2375 GetSourceExpression(source9),
2376 GetSourceExpression(source10),
2377 GetSourceExpression(source11),
2378 resultSelector
2379 )
2380 );
2381 }
2382 #endif
2383
2384 #if !NO_LARGEARITY
2385 /// <summary>
2386 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2387 /// </summary>
2388 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2389 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2390 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2391 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2392 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2393 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2394 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2395 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2396 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2397 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2398 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2399 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
2400 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2401 /// <param name="source1">First observable source.</param>
2402 /// <param name="source2">Second observable source.</param>
2403 /// <param name="source3">Third observable source.</param>
2404 /// <param name="source4">Fourth observable source.</param>
2405 /// <param name="source5">Fifth observable source.</param>
2406 /// <param name="source6">Sixth observable source.</param>
2407 /// <param name="source7">Seventh observable source.</param>
2408 /// <param name="source8">Eighth observable source.</param>
2409 /// <param name="source9">Ninth observable source.</param>
2410 /// <param name="source10">Tenth observable source.</param>
2411 /// <param name="source11">Eleventh observable source.</param>
2412 /// <param name="source12">Twelfth observable source.</param>
2413 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2414 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2415 /// <exception cref="T:System.ArgumentNullException">
2416 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="resultSelector" /> is null.</exception>
2417 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>> resultSelector)
2418 {
2419 if (source1 == null)
2420 throw new ArgumentNullException("source1");
2421 if (source2 == null)
2422 throw new ArgumentNullException("source2");
2423 if (source3 == null)
2424 throw new ArgumentNullException("source3");
2425 if (source4 == null)
2426 throw new ArgumentNullException("source4");
2427 if (source5 == null)
2428 throw new ArgumentNullException("source5");
2429 if (source6 == null)
2430 throw new ArgumentNullException("source6");
2431 if (source7 == null)
2432 throw new ArgumentNullException("source7");
2433 if (source8 == null)
2434 throw new ArgumentNullException("source8");
2435 if (source9 == null)
2436 throw new ArgumentNullException("source9");
2437 if (source10 == null)
2438 throw new ArgumentNullException("source10");
2439 if (source11 == null)
2440 throw new ArgumentNullException("source11");
2441 if (source12 == null)
2442 throw new ArgumentNullException("source12");
2443 if (resultSelector == null)
2444 throw new ArgumentNullException("resultSelector");
2445
2446 return source1.Provider.CreateQuery<TResult>(
2447 Expression.Call(
2448 null,
2449 #if CRIPPLED_REFLECTION
2450 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>>))),
2451 #else
2452 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TResult)),
2453 #endif
2454 source1.Expression,
2455 GetSourceExpression(source2),
2456 GetSourceExpression(source3),
2457 GetSourceExpression(source4),
2458 GetSourceExpression(source5),
2459 GetSourceExpression(source6),
2460 GetSourceExpression(source7),
2461 GetSourceExpression(source8),
2462 GetSourceExpression(source9),
2463 GetSourceExpression(source10),
2464 GetSourceExpression(source11),
2465 GetSourceExpression(source12),
2466 resultSelector
2467 )
2468 );
2469 }
2470 #endif
2471
2472 #if !NO_LARGEARITY
2473 /// <summary>
2474 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2475 /// </summary>
2476 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2477 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2478 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2479 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2480 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2481 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2482 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2483 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2484 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2485 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2486 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2487 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
2488 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
2489 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2490 /// <param name="source1">First observable source.</param>
2491 /// <param name="source2">Second observable source.</param>
2492 /// <param name="source3">Third observable source.</param>
2493 /// <param name="source4">Fourth observable source.</param>
2494 /// <param name="source5">Fifth observable source.</param>
2495 /// <param name="source6">Sixth observable source.</param>
2496 /// <param name="source7">Seventh observable source.</param>
2497 /// <param name="source8">Eighth observable source.</param>
2498 /// <param name="source9">Ninth observable source.</param>
2499 /// <param name="source10">Tenth observable source.</param>
2500 /// <param name="source11">Eleventh observable source.</param>
2501 /// <param name="source12">Twelfth observable source.</param>
2502 /// <param name="source13">Thirteenth observable source.</param>
2503 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2504 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2505 /// <exception cref="T:System.ArgumentNullException">
2506 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="resultSelector" /> is null.</exception>
2507 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>> resultSelector)
2508 {
2509 if (source1 == null)
2510 throw new ArgumentNullException("source1");
2511 if (source2 == null)
2512 throw new ArgumentNullException("source2");
2513 if (source3 == null)
2514 throw new ArgumentNullException("source3");
2515 if (source4 == null)
2516 throw new ArgumentNullException("source4");
2517 if (source5 == null)
2518 throw new ArgumentNullException("source5");
2519 if (source6 == null)
2520 throw new ArgumentNullException("source6");
2521 if (source7 == null)
2522 throw new ArgumentNullException("source7");
2523 if (source8 == null)
2524 throw new ArgumentNullException("source8");
2525 if (source9 == null)
2526 throw new ArgumentNullException("source9");
2527 if (source10 == null)
2528 throw new ArgumentNullException("source10");
2529 if (source11 == null)
2530 throw new ArgumentNullException("source11");
2531 if (source12 == null)
2532 throw new ArgumentNullException("source12");
2533 if (source13 == null)
2534 throw new ArgumentNullException("source13");
2535 if (resultSelector == null)
2536 throw new ArgumentNullException("resultSelector");
2537
2538 return source1.Provider.CreateQuery<TResult>(
2539 Expression.Call(
2540 null,
2541 #if CRIPPLED_REFLECTION
2542 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>>))),
2543 #else
2544 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TResult)),
2545 #endif
2546 source1.Expression,
2547 GetSourceExpression(source2),
2548 GetSourceExpression(source3),
2549 GetSourceExpression(source4),
2550 GetSourceExpression(source5),
2551 GetSourceExpression(source6),
2552 GetSourceExpression(source7),
2553 GetSourceExpression(source8),
2554 GetSourceExpression(source9),
2555 GetSourceExpression(source10),
2556 GetSourceExpression(source11),
2557 GetSourceExpression(source12),
2558 GetSourceExpression(source13),
2559 resultSelector
2560 )
2561 );
2562 }
2563 #endif
2564
2565 #if !NO_LARGEARITY
2566 /// <summary>
2567 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2568 /// </summary>
2569 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2570 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2571 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2572 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2573 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2574 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2575 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2576 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2577 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2578 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2579 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2580 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
2581 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
2582 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
2583 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2584 /// <param name="source1">First observable source.</param>
2585 /// <param name="source2">Second observable source.</param>
2586 /// <param name="source3">Third observable source.</param>
2587 /// <param name="source4">Fourth observable source.</param>
2588 /// <param name="source5">Fifth observable source.</param>
2589 /// <param name="source6">Sixth observable source.</param>
2590 /// <param name="source7">Seventh observable source.</param>
2591 /// <param name="source8">Eighth observable source.</param>
2592 /// <param name="source9">Ninth observable source.</param>
2593 /// <param name="source10">Tenth observable source.</param>
2594 /// <param name="source11">Eleventh observable source.</param>
2595 /// <param name="source12">Twelfth observable source.</param>
2596 /// <param name="source13">Thirteenth observable source.</param>
2597 /// <param name="source14">Fourteenth observable source.</param>
2598 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2599 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2600 /// <exception cref="T:System.ArgumentNullException">
2601 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="resultSelector" /> is null.</exception>
2602 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>> resultSelector)
2603 {
2604 if (source1 == null)
2605 throw new ArgumentNullException("source1");
2606 if (source2 == null)
2607 throw new ArgumentNullException("source2");
2608 if (source3 == null)
2609 throw new ArgumentNullException("source3");
2610 if (source4 == null)
2611 throw new ArgumentNullException("source4");
2612 if (source5 == null)
2613 throw new ArgumentNullException("source5");
2614 if (source6 == null)
2615 throw new ArgumentNullException("source6");
2616 if (source7 == null)
2617 throw new ArgumentNullException("source7");
2618 if (source8 == null)
2619 throw new ArgumentNullException("source8");
2620 if (source9 == null)
2621 throw new ArgumentNullException("source9");
2622 if (source10 == null)
2623 throw new ArgumentNullException("source10");
2624 if (source11 == null)
2625 throw new ArgumentNullException("source11");
2626 if (source12 == null)
2627 throw new ArgumentNullException("source12");
2628 if (source13 == null)
2629 throw new ArgumentNullException("source13");
2630 if (source14 == null)
2631 throw new ArgumentNullException("source14");
2632 if (resultSelector == null)
2633 throw new ArgumentNullException("resultSelector");
2634
2635 return source1.Provider.CreateQuery<TResult>(
2636 Expression.Call(
2637 null,
2638 #if CRIPPLED_REFLECTION
2639 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>>))),
2640 #else
2641 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TResult)),
2642 #endif
2643 source1.Expression,
2644 GetSourceExpression(source2),
2645 GetSourceExpression(source3),
2646 GetSourceExpression(source4),
2647 GetSourceExpression(source5),
2648 GetSourceExpression(source6),
2649 GetSourceExpression(source7),
2650 GetSourceExpression(source8),
2651 GetSourceExpression(source9),
2652 GetSourceExpression(source10),
2653 GetSourceExpression(source11),
2654 GetSourceExpression(source12),
2655 GetSourceExpression(source13),
2656 GetSourceExpression(source14),
2657 resultSelector
2658 )
2659 );
2660 }
2661 #endif
2662
2663 #if !NO_LARGEARITY
2664 /// <summary>
2665 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2666 /// </summary>
2667 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2668 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2669 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2670 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2671 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2672 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2673 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2674 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2675 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2676 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2677 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2678 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
2679 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
2680 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
2681 /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
2682 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2683 /// <param name="source1">First observable source.</param>
2684 /// <param name="source2">Second observable source.</param>
2685 /// <param name="source3">Third observable source.</param>
2686 /// <param name="source4">Fourth observable source.</param>
2687 /// <param name="source5">Fifth observable source.</param>
2688 /// <param name="source6">Sixth observable source.</param>
2689 /// <param name="source7">Seventh observable source.</param>
2690 /// <param name="source8">Eighth observable source.</param>
2691 /// <param name="source9">Ninth observable source.</param>
2692 /// <param name="source10">Tenth observable source.</param>
2693 /// <param name="source11">Eleventh observable source.</param>
2694 /// <param name="source12">Twelfth observable source.</param>
2695 /// <param name="source13">Thirteenth observable source.</param>
2696 /// <param name="source14">Fourteenth observable source.</param>
2697 /// <param name="source15">Fifteenth observable source.</param>
2698 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2699 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2700 /// <exception cref="T:System.ArgumentNullException">
2701 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="resultSelector" /> is null.</exception>
2702 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>> resultSelector)
2703 {
2704 if (source1 == null)
2705 throw new ArgumentNullException("source1");
2706 if (source2 == null)
2707 throw new ArgumentNullException("source2");
2708 if (source3 == null)
2709 throw new ArgumentNullException("source3");
2710 if (source4 == null)
2711 throw new ArgumentNullException("source4");
2712 if (source5 == null)
2713 throw new ArgumentNullException("source5");
2714 if (source6 == null)
2715 throw new ArgumentNullException("source6");
2716 if (source7 == null)
2717 throw new ArgumentNullException("source7");
2718 if (source8 == null)
2719 throw new ArgumentNullException("source8");
2720 if (source9 == null)
2721 throw new ArgumentNullException("source9");
2722 if (source10 == null)
2723 throw new ArgumentNullException("source10");
2724 if (source11 == null)
2725 throw new ArgumentNullException("source11");
2726 if (source12 == null)
2727 throw new ArgumentNullException("source12");
2728 if (source13 == null)
2729 throw new ArgumentNullException("source13");
2730 if (source14 == null)
2731 throw new ArgumentNullException("source14");
2732 if (source15 == null)
2733 throw new ArgumentNullException("source15");
2734 if (resultSelector == null)
2735 throw new ArgumentNullException("resultSelector");
2736
2737 return source1.Provider.CreateQuery<TResult>(
2738 Expression.Call(
2739 null,
2740 #if CRIPPLED_REFLECTION
2741 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>>))),
2742 #else
2743 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TResult)),
2744 #endif
2745 source1.Expression,
2746 GetSourceExpression(source2),
2747 GetSourceExpression(source3),
2748 GetSourceExpression(source4),
2749 GetSourceExpression(source5),
2750 GetSourceExpression(source6),
2751 GetSourceExpression(source7),
2752 GetSourceExpression(source8),
2753 GetSourceExpression(source9),
2754 GetSourceExpression(source10),
2755 GetSourceExpression(source11),
2756 GetSourceExpression(source12),
2757 GetSourceExpression(source13),
2758 GetSourceExpression(source14),
2759 GetSourceExpression(source15),
2760 resultSelector
2761 )
2762 );
2763 }
2764 #endif
2765
2766 #if !NO_LARGEARITY
2767 /// <summary>
2768 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
2769 /// </summary>
2770 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
2771 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
2772 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
2773 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
2774 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
2775 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
2776 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
2777 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
2778 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
2779 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
2780 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
2781 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
2782 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
2783 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
2784 /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
2785 /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
2786 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
2787 /// <param name="source1">First observable source.</param>
2788 /// <param name="source2">Second observable source.</param>
2789 /// <param name="source3">Third observable source.</param>
2790 /// <param name="source4">Fourth observable source.</param>
2791 /// <param name="source5">Fifth observable source.</param>
2792 /// <param name="source6">Sixth observable source.</param>
2793 /// <param name="source7">Seventh observable source.</param>
2794 /// <param name="source8">Eighth observable source.</param>
2795 /// <param name="source9">Ninth observable source.</param>
2796 /// <param name="source10">Tenth observable source.</param>
2797 /// <param name="source11">Eleventh observable source.</param>
2798 /// <param name="source12">Twelfth observable source.</param>
2799 /// <param name="source13">Thirteenth observable source.</param>
2800 /// <param name="source14">Fourteenth observable source.</param>
2801 /// <param name="source15">Fifteenth observable source.</param>
2802 /// <param name="source16">Sixteenth observable source.</param>
2803 /// <param name="resultSelector">Function to invoke whenever any of the sources produces an element.</param>
2804 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
2805 /// <exception cref="T:System.ArgumentNullException">
2806 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="source16" /> or <paramref name="resultSelector" /> is null.</exception>
2807 public static IQbservable<TResult> CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>> resultSelector)
2808 {
2809 if (source1 == null)
2810 throw new ArgumentNullException("source1");
2811 if (source2 == null)
2812 throw new ArgumentNullException("source2");
2813 if (source3 == null)
2814 throw new ArgumentNullException("source3");
2815 if (source4 == null)
2816 throw new ArgumentNullException("source4");
2817 if (source5 == null)
2818 throw new ArgumentNullException("source5");
2819 if (source6 == null)
2820 throw new ArgumentNullException("source6");
2821 if (source7 == null)
2822 throw new ArgumentNullException("source7");
2823 if (source8 == null)
2824 throw new ArgumentNullException("source8");
2825 if (source9 == null)
2826 throw new ArgumentNullException("source9");
2827 if (source10 == null)
2828 throw new ArgumentNullException("source10");
2829 if (source11 == null)
2830 throw new ArgumentNullException("source11");
2831 if (source12 == null)
2832 throw new ArgumentNullException("source12");
2833 if (source13 == null)
2834 throw new ArgumentNullException("source13");
2835 if (source14 == null)
2836 throw new ArgumentNullException("source14");
2837 if (source15 == null)
2838 throw new ArgumentNullException("source15");
2839 if (source16 == null)
2840 throw new ArgumentNullException("source16");
2841 if (resultSelector == null)
2842 throw new ArgumentNullException("resultSelector");
2843
2844 return source1.Provider.CreateQuery<TResult>(
2845 Expression.Call(
2846 null,
2847 #if CRIPPLED_REFLECTION
2848 InfoOf(() => Qbservable.CombineLatest<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(IObservable<TSource16>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>>))),
2849 #else
2850 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TSource16), typeof(TResult)),
2851 #endif
2852 source1.Expression,
2853 GetSourceExpression(source2),
2854 GetSourceExpression(source3),
2855 GetSourceExpression(source4),
2856 GetSourceExpression(source5),
2857 GetSourceExpression(source6),
2858 GetSourceExpression(source7),
2859 GetSourceExpression(source8),
2860 GetSourceExpression(source9),
2861 GetSourceExpression(source10),
2862 GetSourceExpression(source11),
2863 GetSourceExpression(source12),
2864 GetSourceExpression(source13),
2865 GetSourceExpression(source14),
2866 GetSourceExpression(source15),
2867 GetSourceExpression(source16),
2868 resultSelector
2869 )
2870 );
2871 }
2872 #endif
2873
2874 /// <summary>
2875 /// Concatenates the second observable sequence to the first observable sequence upon successful termination of the first.
2876 /// </summary>
2877 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
2878 /// <param name="first">First observable sequence.</param>
2879 /// <param name="second">Second observable sequence.</param>
2880 /// <returns>An observable sequence that contains the elements of the first sequence, followed by those of the second the sequence.</returns>
2881 /// <exception cref="T:System.ArgumentNullException">
2882 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
2883 public static IQbservable<TSource> Concat<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
2884 {
2885 if (first == null)
2886 throw new ArgumentNullException("first");
2887 if (second == null)
2888 throw new ArgumentNullException("second");
2889
2890 return first.Provider.CreateQuery<TSource>(
2891 Expression.Call(
2892 null,
2893 #if CRIPPLED_REFLECTION
2894 InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
2895 #else
2896 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
2897 #endif
2898 first.Expression,
2899 GetSourceExpression(second)
2900 )
2901 );
2902 }
2903
2904 /// <summary>
2905 /// Concatenates all of the specified observable sequences, as long as the previous observable sequence terminated successfully.
2906 /// </summary>
2907 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
2908 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
2909 /// <param name="sources">Observable sequences to concatenate.</param>
2910 /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
2911 /// <exception cref="T:System.ArgumentNullException">
2912 /// <paramref name="sources" /> is null.</exception>
2913 public static IQbservable<TSource> Concat<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
2914 {
2915 if (provider == null)
2916 throw new ArgumentNullException("provider");
2917 if (sources == null)
2918 throw new ArgumentNullException("sources");
2919
2920 return provider.CreateQuery<TSource>(
2921 Expression.Call(
2922 null,
2923 #if CRIPPLED_REFLECTION
2924 InfoOf(() => Qbservable.Concat<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
2925 #else
2926 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
2927 #endif
2928 Expression.Constant(provider, typeof(IQbservableProvider)),
2929 GetSourceExpression(sources)
2930 )
2931 );
2932 }
2933
2934 /// <summary>
2935 /// Concatenates all observable sequences in the given enumerable sequence, as long as the previous observable sequence terminated successfully.
2936 /// </summary>
2937 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
2938 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
2939 /// <param name="sources">Observable sequences to concatenate.</param>
2940 /// <returns>An observable sequence that contains the elements of each given sequence, in sequential order.</returns>
2941 /// <exception cref="T:System.ArgumentNullException">
2942 /// <paramref name="sources" /> is null.</exception>
2943 public static IQbservable<TSource> Concat<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
2944 {
2945 if (provider == null)
2946 throw new ArgumentNullException("provider");
2947 if (sources == null)
2948 throw new ArgumentNullException("sources");
2949
2950 return provider.CreateQuery<TSource>(
2951 Expression.Call(
2952 null,
2953 #if CRIPPLED_REFLECTION
2954 InfoOf(() => Qbservable.Concat<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
2955 #else
2956 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
2957 #endif
2958 Expression.Constant(provider, typeof(IQbservableProvider)),
2959 GetSourceExpression(sources)
2960 )
2961 );
2962 }
2963
2964 /// <summary>
2965 /// Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.
2966 /// </summary>
2967 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
2968 /// <param name="sources">Observable sequence of inner observable sequences.</param>
2969 /// <returns>An observable sequence that contains the elements of each observed inner sequence, in sequential order.</returns>
2970 /// <exception cref="T:System.ArgumentNullException">
2971 /// <paramref name="sources" /> is null.</exception>
2972 public static IQbservable<TSource> Concat<TSource>(this IQbservable<IObservable<TSource>> sources)
2973 {
2974 if (sources == null)
2975 throw new ArgumentNullException("sources");
2976
2977 return sources.Provider.CreateQuery<TSource>(
2978 Expression.Call(
2979 null,
2980 #if CRIPPLED_REFLECTION
2981 InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<IObservable<TSource>>))),
2982 #else
2983 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
2984 #endif
2985 sources.Expression
2986 )
2987 );
2988 }
2989
2990 #if !NO_TPL
2991 /// <summary>
2992 /// Concatenates all task results, as long as the previous task terminated successfully.
2993 /// </summary>
2994 /// <typeparam name="TSource">The type of the results produced by the tasks.</typeparam>
2995 /// <param name="sources">Observable sequence of tasks.</param>
2996 /// <returns>An observable sequence that contains the results of each task, in sequential order.</returns>
2997 /// <exception cref="T:System.ArgumentNullException">
2998 /// <paramref name="sources" /> is null.</exception>
2999 /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a concatenation operation using <see cref="M:System.Reactive.Linq.Observable.Concat``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
3000 public static IQbservable<TSource> Concat<TSource>(this IQbservable<Task<TSource>> sources)
3001 {
3002 if (sources == null)
3003 throw new ArgumentNullException("sources");
3004
3005 return sources.Provider.CreateQuery<TSource>(
3006 Expression.Call(
3007 null,
3008 #if CRIPPLED_REFLECTION
3009 InfoOf(() => Qbservable.Concat<TSource>(default(IQbservable<Task<TSource>>))),
3010 #else
3011 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3012 #endif
3013 sources.Expression
3014 )
3015 );
3016 }
3017 #endif
3018
3019 /// <summary>
3020 /// Determines whether an observable sequence contains a specified element by using the default equality comparer.
3021 /// </summary>
3022 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3023 /// <param name="source">An observable sequence in which to locate a value.</param>
3024 /// <param name="value">The value to locate in the source sequence.</param>
3025 /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
3026 /// <exception cref="T:System.ArgumentNullException">
3027 /// <paramref name="source" /> is null.</exception>
3028 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
3029 public static IQbservable<bool> Contains<TSource>(this IQbservable<TSource> source, TSource value)
3030 {
3031 if (source == null)
3032 throw new ArgumentNullException("source");
3033
3034 return source.Provider.CreateQuery<bool>(
3035 Expression.Call(
3036 null,
3037 #if CRIPPLED_REFLECTION
3038 InfoOf(() => Qbservable.Contains<TSource>(default(IQbservable<TSource>), default(TSource))),
3039 #else
3040 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3041 #endif
3042 source.Expression,
3043 Expression.Constant(value, typeof(TSource))
3044 )
3045 );
3046 }
3047
3048 /// <summary>
3049 /// Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer&lt;T&gt;.
3050 /// </summary>
3051 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3052 /// <param name="source">An observable sequence in which to locate a value.</param>
3053 /// <param name="value">The value to locate in the source sequence.</param>
3054 /// <param name="comparer">An equality comparer to compare elements.</param>
3055 /// <returns>An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.</returns>
3056 /// <exception cref="T:System.ArgumentNullException">
3057 /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
3058 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
3059 public static IQbservable<bool> Contains<TSource>(this IQbservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
3060 {
3061 if (source == null)
3062 throw new ArgumentNullException("source");
3063 if (comparer == null)
3064 throw new ArgumentNullException("comparer");
3065
3066 return source.Provider.CreateQuery<bool>(
3067 Expression.Call(
3068 null,
3069 #if CRIPPLED_REFLECTION
3070 InfoOf(() => Qbservable.Contains<TSource>(default(IQbservable<TSource>), default(TSource), default(IEqualityComparer<TSource>))),
3071 #else
3072 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3073 #endif
3074 source.Expression,
3075 Expression.Constant(value, typeof(TSource)),
3076 Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
3077 )
3078 );
3079 }
3080
3081 /// <summary>
3082 /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents the total number of elements in an observable sequence.
3083 /// </summary>
3084 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3085 /// <param name="source">An observable sequence that contains elements to be counted.</param>
3086 /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
3087 /// <exception cref="T:System.ArgumentNullException">
3088 /// <paramref name="source" /> is null.</exception>
3089 /// <exception cref="T:System.OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
3090 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
3091 public static IQbservable<int> Count<TSource>(this IQbservable<TSource> source)
3092 {
3093 if (source == null)
3094 throw new ArgumentNullException("source");
3095
3096 return source.Provider.CreateQuery<int>(
3097 Expression.Call(
3098 null,
3099 #if CRIPPLED_REFLECTION
3100 InfoOf(() => Qbservable.Count<TSource>(default(IQbservable<TSource>))),
3101 #else
3102 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3103 #endif
3104 source.Expression
3105 )
3106 );
3107 }
3108
3109 /// <summary>
3110 /// Returns an observable sequence containing an <see cref="T:System.Int32" /> that represents how many elements in the specified observable sequence satisfy a condition.
3111 /// </summary>
3112 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3113 /// <param name="source">An observable sequence that contains elements to be counted.</param>
3114 /// <param name="predicate">A function to test each element for a condition.</param>
3115 /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
3116 /// <exception cref="T:System.ArgumentNullException">
3117 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
3118 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
3119 public static IQbservable<int> Count<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
3120 {
3121 if (source == null)
3122 throw new ArgumentNullException("source");
3123 if (predicate == null)
3124 throw new ArgumentNullException("predicate");
3125
3126 return source.Provider.CreateQuery<int>(
3127 Expression.Call(
3128 null,
3129 #if CRIPPLED_REFLECTION
3130 InfoOf(() => Qbservable.Count<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
3131 #else
3132 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3133 #endif
3134 source.Expression,
3135 predicate
3136 )
3137 );
3138 }
3139
3140 /// <summary>
3141 /// Creates an observable sequence from a specified Subscribe method implementation.
3142 /// </summary>
3143 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3144 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3145 /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method.</param>
3146 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3147 /// <exception cref="T:System.ArgumentNullException">
3148 /// <paramref name="subscribe" /> is null.</exception>
3149 /// <remarks>
3150 /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
3151 /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
3152 /// the <see cref="T:System.Reactive.ObservableBase`1" /> abstract base class.
3153 /// </remarks>
3154 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, IDisposable>> subscribe)
3155 {
3156 if (provider == null)
3157 throw new ArgumentNullException("provider");
3158 if (subscribe == null)
3159 throw new ArgumentNullException("subscribe");
3160
3161 return provider.CreateQuery<TResult>(
3162 Expression.Call(
3163 null,
3164 #if CRIPPLED_REFLECTION
3165 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, IDisposable>>))),
3166 #else
3167 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3168 #endif
3169 Expression.Constant(provider, typeof(IQbservableProvider)),
3170 subscribe
3171 )
3172 );
3173 }
3174
3175 /// <summary>
3176 /// Creates an observable sequence from a specified Subscribe method implementation.
3177 /// </summary>
3178 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3179 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3180 /// <param name="subscribe">Implementation of the resulting observable sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
3181 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3182 /// <exception cref="T:System.ArgumentNullException">
3183 /// <paramref name="subscribe" /> is null.</exception>
3184 /// <remarks>
3185 /// Use of this operator is preferred over manual implementation of the IObservable&lt;T&gt; interface. In case
3186 /// you need a type implementing IObservable&lt;T&gt; rather than an anonymous implementation, consider using
3187 /// the <see cref="T:System.Reactive.ObservableBase`1" /> abstract base class.
3188 /// </remarks>
3189 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Action>> subscribe)
3190 {
3191 if (provider == null)
3192 throw new ArgumentNullException("provider");
3193 if (subscribe == null)
3194 throw new ArgumentNullException("subscribe");
3195
3196 return provider.CreateQuery<TResult>(
3197 Expression.Call(
3198 null,
3199 #if CRIPPLED_REFLECTION
3200 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Action>>))),
3201 #else
3202 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3203 #endif
3204 Expression.Constant(provider, typeof(IQbservableProvider)),
3205 subscribe
3206 )
3207 );
3208 }
3209
3210 #if !NO_TPL
3211 /// <summary>
3212 /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
3213 /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
3214 /// </summary>
3215 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3216 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3217 /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
3218 /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
3219 /// <exception cref="T:System.ArgumentNullException">
3220 /// <paramref name="subscribeAsync" /> is null.</exception>
3221 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3222 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
3223 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task>> subscribeAsync)
3224 {
3225 if (provider == null)
3226 throw new ArgumentNullException("provider");
3227 if (subscribeAsync == null)
3228 throw new ArgumentNullException("subscribeAsync");
3229
3230 return provider.CreateQuery<TResult>(
3231 Expression.Call(
3232 null,
3233 #if CRIPPLED_REFLECTION
3234 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task>>))),
3235 #else
3236 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3237 #endif
3238 Expression.Constant(provider, typeof(IQbservableProvider)),
3239 subscribeAsync
3240 )
3241 );
3242 }
3243 #endif
3244
3245 #if !NO_TPL
3246 /// <summary>
3247 /// Creates an observable sequence from a specified asynchronous Subscribe method.
3248 /// </summary>
3249 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3250 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3251 /// <param name="subscribeAsync">Asynchronous method used to produce elements.</param>
3252 /// <returns>The observable sequence surfacing the elements produced by the asynchronous method.</returns>
3253 /// <exception cref="T:System.ArgumentNullException">
3254 /// <paramref name="subscribeAsync" /> is null.</exception>
3255 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3256 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task>> subscribeAsync)
3257 {
3258 if (provider == null)
3259 throw new ArgumentNullException("provider");
3260 if (subscribeAsync == null)
3261 throw new ArgumentNullException("subscribeAsync");
3262
3263 return provider.CreateQuery<TResult>(
3264 Expression.Call(
3265 null,
3266 #if CRIPPLED_REFLECTION
3267 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task>>))),
3268 #else
3269 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3270 #endif
3271 Expression.Constant(provider, typeof(IQbservableProvider)),
3272 subscribeAsync
3273 )
3274 );
3275 }
3276 #endif
3277
3278 #if !NO_TPL
3279 /// <summary>
3280 /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
3281 /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
3282 /// </summary>
3283 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3284 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3285 /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
3286 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3287 /// <exception cref="T:System.ArgumentNullException">
3288 /// <paramref name="subscribeAsync" /> is null.</exception>
3289 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3290 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
3291 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task<IDisposable>>> subscribeAsync)
3292 {
3293 if (provider == null)
3294 throw new ArgumentNullException("provider");
3295 if (subscribeAsync == null)
3296 throw new ArgumentNullException("subscribeAsync");
3297
3298 return provider.CreateQuery<TResult>(
3299 Expression.Call(
3300 null,
3301 #if CRIPPLED_REFLECTION
3302 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task<IDisposable>>>))),
3303 #else
3304 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3305 #endif
3306 Expression.Constant(provider, typeof(IQbservableProvider)),
3307 subscribeAsync
3308 )
3309 );
3310 }
3311 #endif
3312
3313 #if !NO_TPL
3314 /// <summary>
3315 /// Creates an observable sequence from a specified asynchronous Subscribe method.
3316 /// </summary>
3317 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3318 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3319 /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method.</param>
3320 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3321 /// <exception cref="T:System.ArgumentNullException">
3322 /// <paramref name="subscribeAsync" /> is null.</exception>
3323 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3324 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task<IDisposable>>> subscribeAsync)
3325 {
3326 if (provider == null)
3327 throw new ArgumentNullException("provider");
3328 if (subscribeAsync == null)
3329 throw new ArgumentNullException("subscribeAsync");
3330
3331 return provider.CreateQuery<TResult>(
3332 Expression.Call(
3333 null,
3334 #if CRIPPLED_REFLECTION
3335 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task<IDisposable>>>))),
3336 #else
3337 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3338 #endif
3339 Expression.Constant(provider, typeof(IQbservableProvider)),
3340 subscribeAsync
3341 )
3342 );
3343 }
3344 #endif
3345
3346 #if !NO_TPL
3347 /// <summary>
3348 /// Creates an observable sequence from a specified cancellable asynchronous Subscribe method.
3349 /// The CancellationToken passed to the asynchronous Subscribe method is tied to the returned disposable subscription, allowing best-effort cancellation.
3350 /// </summary>
3351 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3352 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3353 /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
3354 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3355 /// <exception cref="T:System.ArgumentNullException">
3356 /// <paramref name="subscribeAsync" /> is null.</exception>
3357 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3358 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous subscribe function will be signaled.</remarks>
3359 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, CancellationToken, Task<Action>>> subscribeAsync)
3360 {
3361 if (provider == null)
3362 throw new ArgumentNullException("provider");
3363 if (subscribeAsync == null)
3364 throw new ArgumentNullException("subscribeAsync");
3365
3366 return provider.CreateQuery<TResult>(
3367 Expression.Call(
3368 null,
3369 #if CRIPPLED_REFLECTION
3370 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, CancellationToken, Task<Action>>>))),
3371 #else
3372 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3373 #endif
3374 Expression.Constant(provider, typeof(IQbservableProvider)),
3375 subscribeAsync
3376 )
3377 );
3378 }
3379 #endif
3380
3381 #if !NO_TPL
3382 /// <summary>
3383 /// Creates an observable sequence from a specified asynchronous Subscribe method.
3384 /// </summary>
3385 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3386 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
3387 /// <param name="subscribeAsync">Asynchronous method used to implemented the resulting sequence's Subscribe method, returning an Action delegate that will be wrapped in an IDisposable.</param>
3388 /// <returns>The observable sequence with the specified implementation for the Subscribe method.</returns>
3389 /// <exception cref="T:System.ArgumentNullException">
3390 /// <paramref name="subscribeAsync" /> is null.</exception>
3391 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3392 public static IQbservable<TResult> Create<TResult>(this IQbservableProvider provider, Expression<Func<IObserver<TResult>, Task<Action>>> subscribeAsync)
3393 {
3394 if (provider == null)
3395 throw new ArgumentNullException("provider");
3396 if (subscribeAsync == null)
3397 throw new ArgumentNullException("subscribeAsync");
3398
3399 return provider.CreateQuery<TResult>(
3400 Expression.Call(
3401 null,
3402 #if CRIPPLED_REFLECTION
3403 InfoOf(() => Qbservable.Create<TResult>(default(IQbservableProvider), default(Expression<Func<IObserver<TResult>, Task<Action>>>))),
3404 #else
3405 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3406 #endif
3407 Expression.Constant(provider, typeof(IQbservableProvider)),
3408 subscribeAsync
3409 )
3410 );
3411 }
3412 #endif
3413
3414 /// <summary>
3415 /// Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty.
3416 /// </summary>
3417 /// <typeparam name="TSource">The type of the elements in the source sequence (if any), whose default value will be taken if the sequence is empty.</typeparam>
3418 /// <param name="source">The sequence to return a default value for if it is empty.</param>
3419 /// <returns>An observable sequence that contains the default value for the TSource type if the source is empty; otherwise, the elements of the source itself.</returns>
3420 /// <exception cref="T:System.ArgumentNullException">
3421 /// <paramref name="source" /> is null.</exception>
3422 public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source)
3423 {
3424 if (source == null)
3425 throw new ArgumentNullException("source");
3426
3427 return source.Provider.CreateQuery<TSource>(
3428 Expression.Call(
3429 null,
3430 #if CRIPPLED_REFLECTION
3431 InfoOf(() => Qbservable.DefaultIfEmpty<TSource>(default(IQbservable<TSource>))),
3432 #else
3433 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3434 #endif
3435 source.Expression
3436 )
3437 );
3438 }
3439
3440 /// <summary>
3441 /// Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
3442 /// </summary>
3443 /// <typeparam name="TSource">The type of the elements in the source sequence (if any), and the specified default value which will be taken if the sequence is empty.</typeparam>
3444 /// <param name="source">The sequence to return the specified value for if it is empty.</param>
3445 /// <param name="defaultValue">The value to return if the sequence is empty.</param>
3446 /// <returns>An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.</returns>
3447 /// <exception cref="T:System.ArgumentNullException">
3448 /// <paramref name="source" /> is null.</exception>
3449 public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source, TSource defaultValue)
3450 {
3451 if (source == null)
3452 throw new ArgumentNullException("source");
3453
3454 return source.Provider.CreateQuery<TSource>(
3455 Expression.Call(
3456 null,
3457 #if CRIPPLED_REFLECTION
3458 InfoOf(() => Qbservable.DefaultIfEmpty<TSource>(default(IQbservable<TSource>), default(TSource))),
3459 #else
3460 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3461 #endif
3462 source.Expression,
3463 Expression.Constant(defaultValue, typeof(TSource))
3464 )
3465 );
3466 }
3467
3468 /// <summary>
3469 /// Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
3470 /// </summary>
3471 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3472 /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
3473 /// <param name="observableFactory">Observable factory function to invoke for each observer that subscribes to the resulting sequence.</param>
3474 /// <returns>An observable sequence whose observers trigger an invocation of the given observable factory function.</returns>
3475 /// <exception cref="T:System.ArgumentNullException">
3476 /// <paramref name="observableFactory" /> is null.</exception>
3477 public static IQbservable<TResult> Defer<TResult>(this IQbservableProvider provider, Expression<Func<IObservable<TResult>>> observableFactory)
3478 {
3479 if (provider == null)
3480 throw new ArgumentNullException("provider");
3481 if (observableFactory == null)
3482 throw new ArgumentNullException("observableFactory");
3483
3484 return provider.CreateQuery<TResult>(
3485 Expression.Call(
3486 null,
3487 #if CRIPPLED_REFLECTION
3488 InfoOf(() => Qbservable.Defer<TResult>(default(IQbservableProvider), default(Expression<Func<IObservable<TResult>>>))),
3489 #else
3490 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3491 #endif
3492 Expression.Constant(provider, typeof(IQbservableProvider)),
3493 observableFactory
3494 )
3495 );
3496 }
3497
3498 #if !NO_TPL
3499 /// <summary>
3500 /// Returns an observable sequence that starts the specified asynchronous factory function whenever a new observer subscribes.
3501 /// </summary>
3502 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3503 /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
3504 /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
3505 /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
3506 /// <exception cref="T:System.ArgumentNullException">
3507 /// <paramref name="observableFactoryAsync" /> is null.</exception>
3508 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3509 public static IQbservable<TResult> Defer<TResult>(this IQbservableProvider provider, Expression<Func<Task<IObservable<TResult>>>> observableFactoryAsync)
3510 {
3511 if (provider == null)
3512 throw new ArgumentNullException("provider");
3513 if (observableFactoryAsync == null)
3514 throw new ArgumentNullException("observableFactoryAsync");
3515
3516 return provider.CreateQuery<TResult>(
3517 Expression.Call(
3518 null,
3519 #if CRIPPLED_REFLECTION
3520 InfoOf(() => Qbservable.Defer<TResult>(default(IQbservableProvider), default(Expression<Func<Task<IObservable<TResult>>>>))),
3521 #else
3522 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3523 #endif
3524 Expression.Constant(provider, typeof(IQbservableProvider)),
3525 observableFactoryAsync
3526 )
3527 );
3528 }
3529 #endif
3530
3531 #if !NO_TPL
3532 /// <summary>
3533 /// Returns an observable sequence that starts the specified cancellable asynchronous factory function whenever a new observer subscribes.
3534 /// The CancellationToken passed to the asynchronous factory function is tied to the returned disposable subscription, allowing best-effort cancellation.
3535 /// </summary>
3536 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
3537 /// <typeparam name="TResult">The type of the elements in the sequence returned by the factory function, and in the resulting sequence.</typeparam>
3538 /// <param name="observableFactoryAsync">Asynchronous factory function to start for each observer that subscribes to the resulting sequence.</param>
3539 /// <returns>An observable sequence whose observers trigger the given asynchronous observable factory function to be started.</returns>
3540 /// <exception cref="T:System.ArgumentNullException">
3541 /// <paramref name="observableFactoryAsync" /> is null.</exception>
3542 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
3543 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous observable factory function will be signaled.</remarks>
3544 public static IQbservable<TResult> DeferAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync)
3545 {
3546 if (provider == null)
3547 throw new ArgumentNullException("provider");
3548 if (observableFactoryAsync == null)
3549 throw new ArgumentNullException("observableFactoryAsync");
3550
3551 return provider.CreateQuery<TResult>(
3552 Expression.Call(
3553 null,
3554 #if CRIPPLED_REFLECTION
3555 InfoOf(() => Qbservable.DeferAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<IObservable<TResult>>>>))),
3556 #else
3557 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
3558 #endif
3559 Expression.Constant(provider, typeof(IQbservableProvider)),
3560 observableFactoryAsync
3561 )
3562 );
3563 }
3564 #endif
3565
3566 /// <summary>
3567 /// Time shifts the observable sequence to start propagating notifications at the specified absolute time.
3568 /// The relative time intervals between the values are preserved.
3569 /// </summary>
3570 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3571 /// <param name="source">Source sequence to delay values for.</param>
3572 /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
3573 /// <returns>Time-shifted sequence.</returns>
3574 /// <exception cref="T:System.ArgumentNullException">
3575 /// <paramref name="source" /> is null.</exception>
3576 /// <remarks>
3577 /// <para>
3578 /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
3579 /// </para>
3580 /// <para>
3581 /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
3582 /// </para>
3583 /// <para>
3584 /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
3585 /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset)">DelaySubscription</see>.
3586 /// </para>
3587 /// </remarks>
3588 public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
3589 {
3590 if (source == null)
3591 throw new ArgumentNullException("source");
3592
3593 return source.Provider.CreateQuery<TSource>(
3594 Expression.Call(
3595 null,
3596 #if CRIPPLED_REFLECTION
3597 InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
3598 #else
3599 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3600 #endif
3601 source.Expression,
3602 Expression.Constant(dueTime, typeof(DateTimeOffset))
3603 )
3604 );
3605 }
3606
3607 /// <summary>
3608 /// Time shifts the observable sequence to start propagating notifications at the specified absolute time, using the specified scheduler to run timers.
3609 /// The relative time intervals between the values are preserved.
3610 /// </summary>
3611 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3612 /// <param name="source">Source sequence to delay values for.</param>
3613 /// <param name="dueTime">Absolute time used to shift the observable sequence; the relative time shift gets computed upon subscription. If this value is less than or equal to DateTimeOffset.UtcNow, the scheduler will dispatch observer callbacks as soon as possible.</param>
3614 /// <param name="scheduler">Scheduler to run the delay timers on.</param>
3615 /// <returns>Time-shifted sequence.</returns>
3616 /// <exception cref="T:System.ArgumentNullException">
3617 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
3618 /// <remarks>
3619 /// <para>
3620 /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
3621 /// </para>
3622 /// <para>
3623 /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
3624 /// </para>
3625 /// <para>
3626 /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
3627 /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see>.
3628 /// </para>
3629 /// </remarks>
3630 public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
3631 {
3632 if (source == null)
3633 throw new ArgumentNullException("source");
3634 if (scheduler == null)
3635 throw new ArgumentNullException("scheduler");
3636
3637 return source.Provider.CreateQuery<TSource>(
3638 Expression.Call(
3639 null,
3640 #if CRIPPLED_REFLECTION
3641 InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
3642 #else
3643 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3644 #endif
3645 source.Expression,
3646 Expression.Constant(dueTime, typeof(DateTimeOffset)),
3647 Expression.Constant(scheduler, typeof(IScheduler))
3648 )
3649 );
3650 }
3651
3652 /// <summary>
3653 /// Time shifts the observable sequence by the specified relative time duration.
3654 /// The relative time intervals between the values are preserved.
3655 /// </summary>
3656 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3657 /// <param name="source">Source sequence to delay values for.</param>
3658 /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
3659 /// <returns>Time-shifted sequence.</returns>
3660 /// <exception cref="T:System.ArgumentNullException">
3661 /// <paramref name="source" /> is null.</exception>
3662 /// <exception cref="T:System.ArgumentOutOfRangeException">
3663 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
3664 /// <remarks>
3665 /// <para>
3666 /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
3667 /// </para>
3668 /// <para>
3669 /// Observer callbacks for the resulting sequence will be run on the default scheduler. This effect is similar to using ObserveOn.
3670 /// </para>
3671 /// <para>
3672 /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
3673 /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan)">DelaySubscription</see>.
3674 /// </para>
3675 /// </remarks>
3676 public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
3677 {
3678 if (source == null)
3679 throw new ArgumentNullException("source");
3680
3681 return source.Provider.CreateQuery<TSource>(
3682 Expression.Call(
3683 null,
3684 #if CRIPPLED_REFLECTION
3685 InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
3686 #else
3687 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3688 #endif
3689 source.Expression,
3690 Expression.Constant(dueTime, typeof(TimeSpan))
3691 )
3692 );
3693 }
3694
3695 /// <summary>
3696 /// Time shifts the observable sequence by the specified relative time duration, using the specified scheduler to run timers.
3697 /// The relative time intervals between the values are preserved.
3698 /// </summary>
3699 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3700 /// <param name="source">Source sequence to delay values for.</param>
3701 /// <param name="dueTime">Relative time by which to shift the observable sequence. If this value is equal to TimeSpan.Zero, the scheduler will dispatch observer callbacks as soon as possible.</param>
3702 /// <param name="scheduler">Scheduler to run the delay timers on.</param>
3703 /// <returns>Time-shifted sequence.</returns>
3704 /// <exception cref="T:System.ArgumentNullException">
3705 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
3706 /// <exception cref="T:System.ArgumentOutOfRangeException">
3707 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
3708 /// <remarks>
3709 /// <para>
3710 /// This operator is less efficient than <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see> because it records all notifications and time-delays those. This allows for immediate propagation of errors.
3711 /// </para>
3712 /// <para>
3713 /// Observer callbacks for the resulting sequence will be run on the specified scheduler. This effect is similar to using ObserveOn.
3714 /// </para>
3715 /// <para>
3716 /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
3717 /// </para>
3718 /// <para>
3719 /// Exceptions signaled by the source sequence through an OnError callback are forwarded immediately to the result sequence. Any OnNext notifications that were in the queue at the point of the OnError callback will be dropped.
3720 /// In order to delay error propagation, consider using the <see cref="M:System.Reactive.Linq.Observable.Materialize``1(System.IObservable{``0})">Observable.Materialize</see> and <see cref="M:System.Reactive.Linq.Observable.Dematerialize``1(System.IObservable{System.Reactive.Notification{``0}})">Observable.Dematerialize</see> operators, or use <see cref="M:System.Reactive.Linq.Observable.DelaySubscription``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">DelaySubscription</see>.
3721 /// </para>
3722 /// </remarks>
3723 public static IQbservable<TSource> Delay<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
3724 {
3725 if (source == null)
3726 throw new ArgumentNullException("source");
3727 if (scheduler == null)
3728 throw new ArgumentNullException("scheduler");
3729
3730 return source.Provider.CreateQuery<TSource>(
3731 Expression.Call(
3732 null,
3733 #if CRIPPLED_REFLECTION
3734 InfoOf(() => Qbservable.Delay<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
3735 #else
3736 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3737 #endif
3738 source.Expression,
3739 Expression.Constant(dueTime, typeof(TimeSpan)),
3740 Expression.Constant(scheduler, typeof(IScheduler))
3741 )
3742 );
3743 }
3744
3745 /// <summary>
3746 /// Time shifts the observable sequence based on a delay selector function for each element.
3747 /// </summary>
3748 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3749 /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
3750 /// <param name="source">Source sequence to delay values for.</param>
3751 /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
3752 /// <returns>Time-shifted sequence.</returns>
3753 /// <exception cref="T:System.ArgumentNullException">
3754 /// <paramref name="source" /> or <paramref name="delayDurationSelector" /> is null.</exception>
3755 public static IQbservable<TSource> Delay<TSource, TDelay>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TDelay>>> delayDurationSelector)
3756 {
3757 if (source == null)
3758 throw new ArgumentNullException("source");
3759 if (delayDurationSelector == null)
3760 throw new ArgumentNullException("delayDurationSelector");
3761
3762 return source.Provider.CreateQuery<TSource>(
3763 Expression.Call(
3764 null,
3765 #if CRIPPLED_REFLECTION
3766 InfoOf(() => Qbservable.Delay<TSource, TDelay>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TDelay>>>))),
3767 #else
3768 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TDelay)),
3769 #endif
3770 source.Expression,
3771 delayDurationSelector
3772 )
3773 );
3774 }
3775
3776 /// <summary>
3777 /// Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
3778 /// </summary>
3779 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3780 /// <typeparam name="TDelay">The type of the elements in the delay sequences used to denote the delay duration of each element in the source sequence.</typeparam>
3781 /// <param name="source">Source sequence to delay values for.</param>
3782 /// <param name="subscriptionDelay">Sequence indicating the delay for the subscription to the source.</param>
3783 /// <param name="delayDurationSelector">Selector function to retrieve a sequence indicating the delay for each given element.</param>
3784 /// <returns>Time-shifted sequence.</returns>
3785 /// <exception cref="T:System.ArgumentNullException">
3786 /// <paramref name="source" /> or <paramref name="subscriptionDelay" /> or <paramref name="delayDurationSelector" /> is null.</exception>
3787 public static IQbservable<TSource> Delay<TSource, TDelay>(this IQbservable<TSource> source, IObservable<TDelay> subscriptionDelay, Expression<Func<TSource, IObservable<TDelay>>> delayDurationSelector)
3788 {
3789 if (source == null)
3790 throw new ArgumentNullException("source");
3791 if (subscriptionDelay == null)
3792 throw new ArgumentNullException("subscriptionDelay");
3793 if (delayDurationSelector == null)
3794 throw new ArgumentNullException("delayDurationSelector");
3795
3796 return source.Provider.CreateQuery<TSource>(
3797 Expression.Call(
3798 null,
3799 #if CRIPPLED_REFLECTION
3800 InfoOf(() => Qbservable.Delay<TSource, TDelay>(default(IQbservable<TSource>), default(IObservable<TDelay>), default(Expression<Func<TSource, IObservable<TDelay>>>))),
3801 #else
3802 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TDelay)),
3803 #endif
3804 source.Expression,
3805 GetSourceExpression(subscriptionDelay),
3806 delayDurationSelector
3807 )
3808 );
3809 }
3810
3811 /// <summary>
3812 /// Time shifts the observable sequence by delaying the subscription to the specified absolute time.
3813 /// </summary>
3814 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3815 /// <param name="source">Source sequence to delay subscription for.</param>
3816 /// <param name="dueTime">Absolute time to perform the subscription at.</param>
3817 /// <returns>Time-shifted sequence.</returns>
3818 /// <exception cref="T:System.ArgumentNullException">
3819 /// <paramref name="source" /> is null.</exception>
3820 /// <remarks>
3821 /// <para>
3822 /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.DateTimeOffset)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
3823 /// </para>
3824 /// <para>
3825 /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
3826 /// </para>
3827 /// </remarks>
3828 public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
3829 {
3830 if (source == null)
3831 throw new ArgumentNullException("source");
3832
3833 return source.Provider.CreateQuery<TSource>(
3834 Expression.Call(
3835 null,
3836 #if CRIPPLED_REFLECTION
3837 InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
3838 #else
3839 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3840 #endif
3841 source.Expression,
3842 Expression.Constant(dueTime, typeof(DateTimeOffset))
3843 )
3844 );
3845 }
3846
3847 /// <summary>
3848 /// Time shifts the observable sequence by delaying the subscription to the specified absolute time, using the specified scheduler to run timers.
3849 /// </summary>
3850 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3851 /// <param name="source">Source sequence to delay subscription for.</param>
3852 /// <param name="dueTime">Absolute time to perform the subscription at.</param>
3853 /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
3854 /// <returns>Time-shifted sequence.</returns>
3855 /// <exception cref="T:System.ArgumentNullException">
3856 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
3857 /// <remarks>
3858 /// <para>
3859 /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
3860 /// </para>
3861 /// <para>
3862 /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
3863 /// </para>
3864 /// </remarks>
3865 public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
3866 {
3867 if (source == null)
3868 throw new ArgumentNullException("source");
3869 if (scheduler == null)
3870 throw new ArgumentNullException("scheduler");
3871
3872 return source.Provider.CreateQuery<TSource>(
3873 Expression.Call(
3874 null,
3875 #if CRIPPLED_REFLECTION
3876 InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
3877 #else
3878 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3879 #endif
3880 source.Expression,
3881 Expression.Constant(dueTime, typeof(DateTimeOffset)),
3882 Expression.Constant(scheduler, typeof(IScheduler))
3883 )
3884 );
3885 }
3886
3887 /// <summary>
3888 /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration.
3889 /// </summary>
3890 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3891 /// <param name="source">Source sequence to delay subscription for.</param>
3892 /// <param name="dueTime">Relative time shift of the subscription.</param>
3893 /// <returns>Time-shifted sequence.</returns>
3894 /// <exception cref="T:System.ArgumentNullException">
3895 /// <paramref name="source" /> is null.</exception>
3896 /// <exception cref="T:System.ArgumentOutOfRangeException">
3897 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
3898 /// <remarks>
3899 /// <para>
3900 /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.TimeSpan)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
3901 /// </para>
3902 /// <para>
3903 /// The side-effects of subscribing to the source sequence will be run on the default scheduler. Observer callbacks will not be affected.
3904 /// </para>
3905 /// </remarks>
3906 public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
3907 {
3908 if (source == null)
3909 throw new ArgumentNullException("source");
3910
3911 return source.Provider.CreateQuery<TSource>(
3912 Expression.Call(
3913 null,
3914 #if CRIPPLED_REFLECTION
3915 InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
3916 #else
3917 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3918 #endif
3919 source.Expression,
3920 Expression.Constant(dueTime, typeof(TimeSpan))
3921 )
3922 );
3923 }
3924
3925 /// <summary>
3926 /// Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
3927 /// </summary>
3928 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3929 /// <param name="source">Source sequence to delay subscription for.</param>
3930 /// <param name="dueTime">Relative time shift of the subscription.</param>
3931 /// <param name="scheduler">Scheduler to run the subscription delay timer on.</param>
3932 /// <returns>Time-shifted sequence.</returns>
3933 /// <exception cref="T:System.ArgumentNullException">
3934 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
3935 /// <exception cref="T:System.ArgumentOutOfRangeException">
3936 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
3937 /// <remarks>
3938 /// <para>
3939 /// This operator is more efficient than <see cref="M:System.Reactive.Linq.Observable.Delay``1(System.IObservable{``0},System.TimeSpan,System.Reactive.Concurrency.IScheduler)">Delay</see> but postpones all side-effects of subscription and affects error propagation timing.
3940 /// </para>
3941 /// <para>
3942 /// The side-effects of subscribing to the source sequence will be run on the specified scheduler. Observer callbacks will not be affected.
3943 /// </para>
3944 /// </remarks>
3945 public static IQbservable<TSource> DelaySubscription<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
3946 {
3947 if (source == null)
3948 throw new ArgumentNullException("source");
3949 if (scheduler == null)
3950 throw new ArgumentNullException("scheduler");
3951
3952 return source.Provider.CreateQuery<TSource>(
3953 Expression.Call(
3954 null,
3955 #if CRIPPLED_REFLECTION
3956 InfoOf(() => Qbservable.DelaySubscription<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
3957 #else
3958 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3959 #endif
3960 source.Expression,
3961 Expression.Constant(dueTime, typeof(TimeSpan)),
3962 Expression.Constant(scheduler, typeof(IScheduler))
3963 )
3964 );
3965 }
3966
3967 /// <summary>
3968 /// Dematerializes the explicit notification values of an observable sequence as implicit notifications.
3969 /// </summary>
3970 /// <typeparam name="TSource">The type of the elements materialized in the source sequence notification objects.</typeparam>
3971 /// <param name="source">An observable sequence containing explicit notification values which have to be turned into implicit notifications.</param>
3972 /// <returns>An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.</returns>
3973 /// <exception cref="T:System.ArgumentNullException">
3974 /// <paramref name="source" /> is null.</exception>
3975 public static IQbservable<TSource> Dematerialize<TSource>(this IQbservable<Notification<TSource>> source)
3976 {
3977 if (source == null)
3978 throw new ArgumentNullException("source");
3979
3980 return source.Provider.CreateQuery<TSource>(
3981 Expression.Call(
3982 null,
3983 #if CRIPPLED_REFLECTION
3984 InfoOf(() => Qbservable.Dematerialize<TSource>(default(IQbservable<Notification<TSource>>))),
3985 #else
3986 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
3987 #endif
3988 source.Expression
3989 )
3990 );
3991 }
3992
3993 /// <summary>
3994 /// Returns an observable sequence that contains only distinct elements.
3995 /// </summary>
3996 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
3997 /// <param name="source">An observable sequence to retain distinct elements for.</param>
3998 /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
3999 /// <exception cref="T:System.ArgumentNullException">
4000 /// <paramref name="source" /> is null.</exception>
4001 /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
4002 public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source)
4003 {
4004 if (source == null)
4005 throw new ArgumentNullException("source");
4006
4007 return source.Provider.CreateQuery<TSource>(
4008 Expression.Call(
4009 null,
4010 #if CRIPPLED_REFLECTION
4011 InfoOf(() => Qbservable.Distinct<TSource>(default(IQbservable<TSource>))),
4012 #else
4013 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4014 #endif
4015 source.Expression
4016 )
4017 );
4018 }
4019
4020 /// <summary>
4021 /// Returns an observable sequence that contains only distinct elements according to the comparer.
4022 /// </summary>
4023 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4024 /// <param name="source">An observable sequence to retain distinct elements for.</param>
4025 /// <param name="comparer">Equality comparer for source elements.</param>
4026 /// <returns>An observable sequence only containing the distinct elements from the source sequence.</returns>
4027 /// <exception cref="T:System.ArgumentNullException">
4028 /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
4029 /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
4030 public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)
4031 {
4032 if (source == null)
4033 throw new ArgumentNullException("source");
4034 if (comparer == null)
4035 throw new ArgumentNullException("comparer");
4036
4037 return source.Provider.CreateQuery<TSource>(
4038 Expression.Call(
4039 null,
4040 #if CRIPPLED_REFLECTION
4041 InfoOf(() => Qbservable.Distinct<TSource>(default(IQbservable<TSource>), default(IEqualityComparer<TSource>))),
4042 #else
4043 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4044 #endif
4045 source.Expression,
4046 Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
4047 )
4048 );
4049 }
4050
4051 /// <summary>
4052 /// Returns an observable sequence that contains only distinct elements according to the keySelector.
4053 /// </summary>
4054 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4055 /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
4056 /// <param name="source">An observable sequence to retain distinct elements for.</param>
4057 /// <param name="keySelector">A function to compute the comparison key for each element.</param>
4058 /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
4059 /// <exception cref="T:System.ArgumentNullException">
4060 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
4061 /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
4062 public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
4063 {
4064 if (source == null)
4065 throw new ArgumentNullException("source");
4066 if (keySelector == null)
4067 throw new ArgumentNullException("keySelector");
4068
4069 return source.Provider.CreateQuery<TSource>(
4070 Expression.Call(
4071 null,
4072 #if CRIPPLED_REFLECTION
4073 InfoOf(() => Qbservable.Distinct<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
4074 #else
4075 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
4076 #endif
4077 source.Expression,
4078 keySelector
4079 )
4080 );
4081 }
4082
4083 /// <summary>
4084 /// Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
4085 /// </summary>
4086 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4087 /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
4088 /// <param name="source">An observable sequence to retain distinct elements for.</param>
4089 /// <param name="keySelector">A function to compute the comparison key for each element.</param>
4090 /// <param name="comparer">Equality comparer for source elements.</param>
4091 /// <returns>An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.</returns>
4092 /// <exception cref="T:System.ArgumentNullException">
4093 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
4094 /// <remarks>Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.</remarks>
4095 public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
4096 {
4097 if (source == null)
4098 throw new ArgumentNullException("source");
4099 if (keySelector == null)
4100 throw new ArgumentNullException("keySelector");
4101 if (comparer == null)
4102 throw new ArgumentNullException("comparer");
4103
4104 return source.Provider.CreateQuery<TSource>(
4105 Expression.Call(
4106 null,
4107 #if CRIPPLED_REFLECTION
4108 InfoOf(() => Qbservable.Distinct<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
4109 #else
4110 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
4111 #endif
4112 source.Expression,
4113 keySelector,
4114 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
4115 )
4116 );
4117 }
4118
4119 /// <summary>
4120 /// Returns an observable sequence that contains only distinct contiguous elements.
4121 /// </summary>
4122 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4123 /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
4124 /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
4125 /// <exception cref="T:System.ArgumentNullException">
4126 /// <paramref name="source" /> is null.</exception>
4127 public static IQbservable<TSource> DistinctUntilChanged<TSource>(this IQbservable<TSource> source)
4128 {
4129 if (source == null)
4130 throw new ArgumentNullException("source");
4131
4132 return source.Provider.CreateQuery<TSource>(
4133 Expression.Call(
4134 null,
4135 #if CRIPPLED_REFLECTION
4136 InfoOf(() => Qbservable.DistinctUntilChanged<TSource>(default(IQbservable<TSource>))),
4137 #else
4138 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4139 #endif
4140 source.Expression
4141 )
4142 );
4143 }
4144
4145 /// <summary>
4146 /// Returns an observable sequence that contains only distinct contiguous elements according to the comparer.
4147 /// </summary>
4148 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4149 /// <param name="source">An observable sequence to retain distinct contiguous elements for.</param>
4150 /// <param name="comparer">Equality comparer for source elements.</param>
4151 /// <returns>An observable sequence only containing the distinct contiguous elements from the source sequence.</returns>
4152 /// <exception cref="T:System.ArgumentNullException">
4153 /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
4154 public static IQbservable<TSource> DistinctUntilChanged<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)
4155 {
4156 if (source == null)
4157 throw new ArgumentNullException("source");
4158 if (comparer == null)
4159 throw new ArgumentNullException("comparer");
4160
4161 return source.Provider.CreateQuery<TSource>(
4162 Expression.Call(
4163 null,
4164 #if CRIPPLED_REFLECTION
4165 InfoOf(() => Qbservable.DistinctUntilChanged<TSource>(default(IQbservable<TSource>), default(IEqualityComparer<TSource>))),
4166 #else
4167 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4168 #endif
4169 source.Expression,
4170 Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
4171 )
4172 );
4173 }
4174
4175 /// <summary>
4176 /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector.
4177 /// </summary>
4178 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4179 /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
4180 /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
4181 /// <param name="keySelector">A function to compute the comparison key for each element.</param>
4182 /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
4183 /// <exception cref="T:System.ArgumentNullException">
4184 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
4185 public static IQbservable<TSource> DistinctUntilChanged<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
4186 {
4187 if (source == null)
4188 throw new ArgumentNullException("source");
4189 if (keySelector == null)
4190 throw new ArgumentNullException("keySelector");
4191
4192 return source.Provider.CreateQuery<TSource>(
4193 Expression.Call(
4194 null,
4195 #if CRIPPLED_REFLECTION
4196 InfoOf(() => Qbservable.DistinctUntilChanged<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
4197 #else
4198 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
4199 #endif
4200 source.Expression,
4201 keySelector
4202 )
4203 );
4204 }
4205
4206 /// <summary>
4207 /// Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
4208 /// </summary>
4209 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4210 /// <typeparam name="TKey">The type of the discriminator key computed for each element in the source sequence.</typeparam>
4211 /// <param name="source">An observable sequence to retain distinct contiguous elements for, based on a computed key value.</param>
4212 /// <param name="keySelector">A function to compute the comparison key for each element.</param>
4213 /// <param name="comparer">Equality comparer for computed key values.</param>
4214 /// <returns>An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.</returns>
4215 /// <exception cref="T:System.ArgumentNullException">
4216 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
4217 public static IQbservable<TSource> DistinctUntilChanged<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
4218 {
4219 if (source == null)
4220 throw new ArgumentNullException("source");
4221 if (keySelector == null)
4222 throw new ArgumentNullException("keySelector");
4223 if (comparer == null)
4224 throw new ArgumentNullException("comparer");
4225
4226 return source.Provider.CreateQuery<TSource>(
4227 Expression.Call(
4228 null,
4229 #if CRIPPLED_REFLECTION
4230 InfoOf(() => Qbservable.DistinctUntilChanged<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
4231 #else
4232 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
4233 #endif
4234 source.Expression,
4235 keySelector,
4236 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
4237 )
4238 );
4239 }
4240
4241 /// <summary>
4242 /// Invokes the observer's methods for each message in the source sequence.
4243 /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4244 /// </summary>
4245 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4246 /// <param name="source">Source sequence.</param>
4247 /// <param name="observer">Observer whose methods to invoke as part of the source sequence's observation.</param>
4248 /// <returns>The source sequence with the side-effecting behavior applied.</returns>
4249 /// <exception cref="T:System.ArgumentNullException">
4250 /// <paramref name="source" /> or <paramref name="observer" /> is null.</exception>
4251 public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, IObserver<TSource> observer)
4252 {
4253 if (source == null)
4254 throw new ArgumentNullException("source");
4255 if (observer == null)
4256 throw new ArgumentNullException("observer");
4257
4258 return source.Provider.CreateQuery<TSource>(
4259 Expression.Call(
4260 null,
4261 #if CRIPPLED_REFLECTION
4262 InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(IObserver<TSource>))),
4263 #else
4264 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4265 #endif
4266 source.Expression,
4267 Expression.Constant(observer, typeof(IObserver<TSource>))
4268 )
4269 );
4270 }
4271
4272 /// <summary>
4273 /// Invokes an action for each element in the observable sequence, and propagates all observer messages through the result sequence.
4274 /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4275 /// </summary>
4276 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4277 /// <param name="source">Source sequence.</param>
4278 /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
4279 /// <returns>The source sequence with the side-effecting behavior applied.</returns>
4280 /// <exception cref="T:System.ArgumentNullException">
4281 /// <paramref name="source" /> or <paramref name="onNext" /> is null.</exception>
4282 public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext)
4283 {
4284 if (source == null)
4285 throw new ArgumentNullException("source");
4286 if (onNext == null)
4287 throw new ArgumentNullException("onNext");
4288
4289 return source.Provider.CreateQuery<TSource>(
4290 Expression.Call(
4291 null,
4292 #if CRIPPLED_REFLECTION
4293 InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>))),
4294 #else
4295 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4296 #endif
4297 source.Expression,
4298 onNext
4299 )
4300 );
4301 }
4302
4303 /// <summary>
4304 /// Invokes an action for each element in the observable sequence and invokes an action upon graceful termination of the observable sequence.
4305 /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4306 /// </summary>
4307 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4308 /// <param name="source">Source sequence.</param>
4309 /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
4310 /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
4311 /// <returns>The source sequence with the side-effecting behavior applied.</returns>
4312 /// <exception cref="T:System.ArgumentNullException">
4313 /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onCompleted" /> is null.</exception>
4314 public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action> onCompleted)
4315 {
4316 if (source == null)
4317 throw new ArgumentNullException("source");
4318 if (onNext == null)
4319 throw new ArgumentNullException("onNext");
4320 if (onCompleted == null)
4321 throw new ArgumentNullException("onCompleted");
4322
4323 return source.Provider.CreateQuery<TSource>(
4324 Expression.Call(
4325 null,
4326 #if CRIPPLED_REFLECTION
4327 InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action>))),
4328 #else
4329 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4330 #endif
4331 source.Expression,
4332 onNext,
4333 onCompleted
4334 )
4335 );
4336 }
4337
4338 /// <summary>
4339 /// Invokes an action for each element in the observable sequence and invokes an action upon exceptional termination of the observable sequence.
4340 /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4341 /// </summary>
4342 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4343 /// <param name="source">Source sequence.</param>
4344 /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
4345 /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
4346 /// <returns>The source sequence with the side-effecting behavior applied.</returns>
4347 /// <exception cref="T:System.ArgumentNullException">
4348 /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> is null.</exception>
4349 public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
4350 {
4351 if (source == null)
4352 throw new ArgumentNullException("source");
4353 if (onNext == null)
4354 throw new ArgumentNullException("onNext");
4355 if (onError == null)
4356 throw new ArgumentNullException("onError");
4357
4358 return source.Provider.CreateQuery<TSource>(
4359 Expression.Call(
4360 null,
4361 #if CRIPPLED_REFLECTION
4362 InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>))),
4363 #else
4364 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4365 #endif
4366 source.Expression,
4367 onNext,
4368 onError
4369 )
4370 );
4371 }
4372
4373 /// <summary>
4374 /// Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
4375 /// This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4376 /// </summary>
4377 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4378 /// <param name="source">Source sequence.</param>
4379 /// <param name="onNext">Action to invoke for each element in the observable sequence.</param>
4380 /// <param name="onError">Action to invoke upon exceptional termination of the observable sequence.</param>
4381 /// <param name="onCompleted">Action to invoke upon graceful termination of the observable sequence.</param>
4382 /// <returns>The source sequence with the side-effecting behavior applied.</returns>
4383 /// <exception cref="T:System.ArgumentNullException">
4384 /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> or <paramref name="onCompleted" /> is null.</exception>
4385 public static IQbservable<TSource> Do<TSource>(this IQbservable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Expression<Action> onCompleted)
4386 {
4387 if (source == null)
4388 throw new ArgumentNullException("source");
4389 if (onNext == null)
4390 throw new ArgumentNullException("onNext");
4391 if (onError == null)
4392 throw new ArgumentNullException("onError");
4393 if (onCompleted == null)
4394 throw new ArgumentNullException("onCompleted");
4395
4396 return source.Provider.CreateQuery<TSource>(
4397 Expression.Call(
4398 null,
4399 #if CRIPPLED_REFLECTION
4400 InfoOf(() => Qbservable.Do<TSource>(default(IQbservable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>), default(Expression<Action>))),
4401 #else
4402 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4403 #endif
4404 source.Expression,
4405 onNext,
4406 onError,
4407 onCompleted
4408 )
4409 );
4410 }
4411
4412 /// <summary>
4413 /// Repeats the given <paramref name="source" /> as long as the specified <paramref name="condition" /> holds, where the <paramref name="condition" /> is evaluated after each repeated <paramref name="source" /> completed.
4414 /// </summary>
4415 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4416 /// <param name="source">Source to repeat as long as the <paramref name="condition" /> function evaluates to true.</param>
4417 /// <param name="condition">Condition that will be evaluated upon the completion of an iteration through the <paramref name="source" />, to determine whether repetition of the source is required.</param>
4418 /// <returns>The observable sequence obtained by concatenating the <paramref name="source" /> sequence as long as the <paramref name="condition" /> holds.</returns>
4419 /// <exception cref="T:System.ArgumentNullException">
4420 /// <paramref name="source" /> or <paramref name="condition" /> is null.</exception>
4421 public static IQbservable<TSource> DoWhile<TSource>(this IQbservable<TSource> source, Expression<Func<bool>> condition)
4422 {
4423 if (source == null)
4424 throw new ArgumentNullException("source");
4425 if (condition == null)
4426 throw new ArgumentNullException("condition");
4427
4428 return source.Provider.CreateQuery<TSource>(
4429 Expression.Call(
4430 null,
4431 #if CRIPPLED_REFLECTION
4432 InfoOf(() => Qbservable.DoWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<bool>>))),
4433 #else
4434 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4435 #endif
4436 source.Expression,
4437 condition
4438 )
4439 );
4440 }
4441
4442 /// <summary>
4443 /// Returns the element at a specified index in a sequence.
4444 /// </summary>
4445 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4446 /// <param name="source">Observable sequence to return the element from.</param>
4447 /// <param name="index">The zero-based index of the element to retrieve.</param>
4448 /// <returns>An observable sequence that produces the element at the specified position in the source sequence.</returns>
4449 /// <exception cref="T:System.ArgumentNullException">
4450 /// <paramref name="source" /> is null.</exception>
4451 /// <exception cref="T:System.ArgumentOutOfRangeException">
4452 /// <paramref name="index" /> is less than zero.</exception>
4453 /// <exception cref="T:System.ArgumentOutOfRangeException">(Asynchronous) <paramref name="index" /> is greater than or equal to the number of elements in the source sequence.</exception>
4454 public static IQbservable<TSource> ElementAt<TSource>(this IQbservable<TSource> source, int index)
4455 {
4456 if (source == null)
4457 throw new ArgumentNullException("source");
4458
4459 return source.Provider.CreateQuery<TSource>(
4460 Expression.Call(
4461 null,
4462 #if CRIPPLED_REFLECTION
4463 InfoOf(() => Qbservable.ElementAt<TSource>(default(IQbservable<TSource>), default(int))),
4464 #else
4465 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4466 #endif
4467 source.Expression,
4468 Expression.Constant(index, typeof(int))
4469 )
4470 );
4471 }
4472
4473 /// <summary>
4474 /// Returns the element at a specified index in a sequence or a default value if the index is out of range.
4475 /// </summary>
4476 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4477 /// <param name="source">Observable sequence to return the element from.</param>
4478 /// <param name="index">The zero-based index of the element to retrieve.</param>
4479 /// <returns>An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.</returns>
4480 /// <exception cref="T:System.ArgumentNullException">
4481 /// <paramref name="source" /> is null.</exception>
4482 /// <exception cref="T:System.ArgumentOutOfRangeException">
4483 /// <paramref name="index" /> is less than zero.</exception>
4484 public static IQbservable<TSource> ElementAtOrDefault<TSource>(this IQbservable<TSource> source, int index)
4485 {
4486 if (source == null)
4487 throw new ArgumentNullException("source");
4488
4489 return source.Provider.CreateQuery<TSource>(
4490 Expression.Call(
4491 null,
4492 #if CRIPPLED_REFLECTION
4493 InfoOf(() => Qbservable.ElementAtOrDefault<TSource>(default(IQbservable<TSource>), default(int))),
4494 #else
4495 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4496 #endif
4497 source.Expression,
4498 Expression.Constant(index, typeof(int))
4499 )
4500 );
4501 }
4502
4503 /// <summary>
4504 /// Returns an empty observable sequence.
4505 /// </summary>
4506 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4507 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
4508 /// <returns>An observable sequence with no elements.</returns>
4509 public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider)
4510 {
4511 if (provider == null)
4512 throw new ArgumentNullException("provider");
4513
4514 return provider.CreateQuery<TResult>(
4515 Expression.Call(
4516 null,
4517 #if CRIPPLED_REFLECTION
4518 InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider))),
4519 #else
4520 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4521 #endif
4522 Expression.Constant(provider, typeof(IQbservableProvider))
4523 )
4524 );
4525 }
4526
4527 /// <summary>
4528 /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
4529 /// </summary>
4530 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4531 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
4532 /// <param name="scheduler">Scheduler to send the termination call on.</param>
4533 /// <returns>An observable sequence with no elements.</returns>
4534 /// <exception cref="T:System.ArgumentNullException">
4535 /// <paramref name="scheduler" /> is null.</exception>
4536 public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, IScheduler scheduler)
4537 {
4538 if (provider == null)
4539 throw new ArgumentNullException("provider");
4540 if (scheduler == null)
4541 throw new ArgumentNullException("scheduler");
4542
4543 return provider.CreateQuery<TResult>(
4544 Expression.Call(
4545 null,
4546 #if CRIPPLED_REFLECTION
4547 InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(IScheduler))),
4548 #else
4549 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4550 #endif
4551 Expression.Constant(provider, typeof(IQbservableProvider)),
4552 Expression.Constant(scheduler, typeof(IScheduler))
4553 )
4554 );
4555 }
4556
4557 /// <summary>
4558 /// Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
4559 /// </summary>
4560 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4561 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
4562 /// <param name="scheduler">Scheduler to send the termination call on.</param>
4563 /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
4564 /// <returns>An observable sequence with no elements.</returns>
4565 /// <exception cref="T:System.ArgumentNullException">
4566 /// <paramref name="scheduler" /> is null.</exception>
4567 public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, IScheduler scheduler, TResult witness)
4568 {
4569 if (provider == null)
4570 throw new ArgumentNullException("provider");
4571 if (scheduler == null)
4572 throw new ArgumentNullException("scheduler");
4573
4574 return provider.CreateQuery<TResult>(
4575 Expression.Call(
4576 null,
4577 #if CRIPPLED_REFLECTION
4578 InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(IScheduler), default(TResult))),
4579 #else
4580 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4581 #endif
4582 Expression.Constant(provider, typeof(IQbservableProvider)),
4583 Expression.Constant(scheduler, typeof(IScheduler)),
4584 Expression.Constant(witness, typeof(TResult))
4585 )
4586 );
4587 }
4588
4589 /// <summary>
4590 /// Returns an empty observable sequence.
4591 /// </summary>
4592 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4593 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
4594 /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
4595 /// <returns>An observable sequence with no elements.</returns>
4596 public static IQbservable<TResult> Empty<TResult>(this IQbservableProvider provider, TResult witness)
4597 {
4598 if (provider == null)
4599 throw new ArgumentNullException("provider");
4600
4601 return provider.CreateQuery<TResult>(
4602 Expression.Call(
4603 null,
4604 #if CRIPPLED_REFLECTION
4605 InfoOf(() => Qbservable.Empty<TResult>(default(IQbservableProvider), default(TResult))),
4606 #else
4607 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4608 #endif
4609 Expression.Constant(provider, typeof(IQbservableProvider)),
4610 Expression.Constant(witness, typeof(TResult))
4611 )
4612 );
4613 }
4614
4615 /// <summary>
4616 /// Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
4617 /// </summary>
4618 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4619 /// <param name="source">Source sequence.</param>
4620 /// <param name="finallyAction">Action to invoke after the source observable sequence terminates.</param>
4621 /// <returns>Source sequence with the action-invoking termination behavior applied.</returns>
4622 /// <exception cref="T:System.ArgumentNullException">
4623 /// <paramref name="source" /> or <paramref name="finallyAction" /> is null.</exception>
4624 public static IQbservable<TSource> Finally<TSource>(this IQbservable<TSource> source, Expression<Action> finallyAction)
4625 {
4626 if (source == null)
4627 throw new ArgumentNullException("source");
4628 if (finallyAction == null)
4629 throw new ArgumentNullException("finallyAction");
4630
4631 return source.Provider.CreateQuery<TSource>(
4632 Expression.Call(
4633 null,
4634 #if CRIPPLED_REFLECTION
4635 InfoOf(() => Qbservable.Finally<TSource>(default(IQbservable<TSource>), default(Expression<Action>))),
4636 #else
4637 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4638 #endif
4639 source.Expression,
4640 finallyAction
4641 )
4642 );
4643 }
4644
4645 /// <summary>
4646 /// Returns the first element of an observable sequence.
4647 /// </summary>
4648 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4649 /// <param name="source">Source observable sequence.</param>
4650 /// <returns>Sequence containing the first element in the observable sequence.</returns>
4651 /// <exception cref="T:System.ArgumentNullException">
4652 /// <paramref name="source" /> is null.</exception>
4653 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
4654 public static IQbservable<TSource> FirstAsync<TSource>(this IQbservable<TSource> source)
4655 {
4656 if (source == null)
4657 throw new ArgumentNullException("source");
4658
4659 return source.Provider.CreateQuery<TSource>(
4660 Expression.Call(
4661 null,
4662 #if CRIPPLED_REFLECTION
4663 InfoOf(() => Qbservable.FirstAsync<TSource>(default(IQbservable<TSource>))),
4664 #else
4665 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4666 #endif
4667 source.Expression
4668 )
4669 );
4670 }
4671
4672 /// <summary>
4673 /// Returns the first element of an observable sequence that satisfies the condition in the predicate.
4674 /// </summary>
4675 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4676 /// <param name="source">Source observable sequence.</param>
4677 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
4678 /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate.</returns>
4679 /// <exception cref="T:System.ArgumentNullException">
4680 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
4681 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
4682 public static IQbservable<TSource> FirstAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
4683 {
4684 if (source == null)
4685 throw new ArgumentNullException("source");
4686 if (predicate == null)
4687 throw new ArgumentNullException("predicate");
4688
4689 return source.Provider.CreateQuery<TSource>(
4690 Expression.Call(
4691 null,
4692 #if CRIPPLED_REFLECTION
4693 InfoOf(() => Qbservable.FirstAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
4694 #else
4695 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4696 #endif
4697 source.Expression,
4698 predicate
4699 )
4700 );
4701 }
4702
4703 /// <summary>
4704 /// Returns the first element of an observable sequence, or a default value if no such element exists.
4705 /// </summary>
4706 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4707 /// <param name="source">Source observable sequence.</param>
4708 /// <returns>Sequence containing the first element in the observable sequence, or a default value if no such element exists.</returns>
4709 /// <exception cref="T:System.ArgumentNullException">
4710 /// <paramref name="source" /> is null.</exception>
4711 public static IQbservable<TSource> FirstOrDefaultAsync<TSource>(this IQbservable<TSource> source)
4712 {
4713 if (source == null)
4714 throw new ArgumentNullException("source");
4715
4716 return source.Provider.CreateQuery<TSource>(
4717 Expression.Call(
4718 null,
4719 #if CRIPPLED_REFLECTION
4720 InfoOf(() => Qbservable.FirstOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
4721 #else
4722 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4723 #endif
4724 source.Expression
4725 )
4726 );
4727 }
4728
4729 /// <summary>
4730 /// Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
4731 /// </summary>
4732 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
4733 /// <param name="source">Source observable sequence.</param>
4734 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
4735 /// <returns>Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
4736 /// <exception cref="T:System.ArgumentNullException">
4737 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
4738 public static IQbservable<TSource> FirstOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
4739 {
4740 if (source == null)
4741 throw new ArgumentNullException("source");
4742 if (predicate == null)
4743 throw new ArgumentNullException("predicate");
4744
4745 return source.Provider.CreateQuery<TSource>(
4746 Expression.Call(
4747 null,
4748 #if CRIPPLED_REFLECTION
4749 InfoOf(() => Qbservable.FirstOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
4750 #else
4751 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
4752 #endif
4753 source.Expression,
4754 predicate
4755 )
4756 );
4757 }
4758
4759 /// <summary>
4760 /// Concatenates the observable sequences obtained by running the <paramref name="resultSelector" /> for each element in the given enumerable <paramref name="source" />.
4761 /// </summary>
4762 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4763 /// <typeparam name="TSource">The type of the elements in the enumerable source sequence.</typeparam>
4764 /// <typeparam name="TResult">The type of the elements in the observable result sequence.</typeparam>
4765 /// <param name="source">Enumerable source for which each element will be mapped onto an observable source that will be concatenated in the result sequence.</param>
4766 /// <param name="resultSelector">Function to select an observable source for each element in the <paramref name="source" />.</param>
4767 /// <returns>The observable sequence obtained by concatenating the sources returned by <paramref name="resultSelector" /> for each element in the <paramref name="source" />.</returns>
4768 /// <exception cref="T:System.ArgumentNullException">
4769 /// <paramref name="source" /> or <paramref name="resultSelector" /> is null.</exception>
4770 public static IQbservable<TResult> For<TSource, TResult>(this IQbservableProvider provider, IEnumerable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> resultSelector)
4771 {
4772 if (provider == null)
4773 throw new ArgumentNullException("provider");
4774 if (source == null)
4775 throw new ArgumentNullException("source");
4776 if (resultSelector == null)
4777 throw new ArgumentNullException("resultSelector");
4778
4779 return provider.CreateQuery<TResult>(
4780 Expression.Call(
4781 null,
4782 #if CRIPPLED_REFLECTION
4783 InfoOf(() => Qbservable.For<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>))),
4784 #else
4785 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
4786 #endif
4787 Expression.Constant(provider, typeof(IQbservableProvider)),
4788 GetSourceExpression(source),
4789 resultSelector
4790 )
4791 );
4792 }
4793
4794 #if !NO_TPL
4795 /// <summary>
4796 /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
4797 /// </summary>
4798 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4799 /// <param name="actionAsync">Asynchronous action to convert.</param>
4800 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
4801 /// <exception cref="T:System.ArgumentNullException">
4802 /// <paramref name="actionAsync" /> is null.</exception>
4803 public static IQbservable<Unit> FromAsync(this IQbservableProvider provider, Expression<Func<Task>> actionAsync)
4804 {
4805 if (provider == null)
4806 throw new ArgumentNullException("provider");
4807 if (actionAsync == null)
4808 throw new ArgumentNullException("actionAsync");
4809
4810 return provider.CreateQuery<Unit>(
4811 Expression.Call(
4812 null,
4813 #if CRIPPLED_REFLECTION
4814 InfoOf(() => Qbservable.FromAsync(default(IQbservableProvider), default(Expression<Func<Task>>))),
4815 #else
4816 (MethodInfo)MethodInfo.GetCurrentMethod(),
4817 #endif
4818 Expression.Constant(provider, typeof(IQbservableProvider)),
4819 actionAsync
4820 )
4821 );
4822 }
4823 #endif
4824
4825 #if !NO_TPL
4826 /// <summary>
4827 /// Converts to asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started.
4828 /// The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation.
4829 /// </summary>
4830 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4831 /// <param name="actionAsync">Asynchronous action to convert.</param>
4832 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
4833 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
4834 /// <exception cref="T:System.ArgumentNullException">
4835 /// <paramref name="actionAsync" /> is null.</exception>
4836 public static IQbservable<Unit> FromAsync(this IQbservableProvider provider, Expression<Func<CancellationToken, Task>> actionAsync)
4837 {
4838 if (provider == null)
4839 throw new ArgumentNullException("provider");
4840 if (actionAsync == null)
4841 throw new ArgumentNullException("actionAsync");
4842
4843 return provider.CreateQuery<Unit>(
4844 Expression.Call(
4845 null,
4846 #if CRIPPLED_REFLECTION
4847 InfoOf(() => Qbservable.FromAsync(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task>>))),
4848 #else
4849 (MethodInfo)MethodInfo.GetCurrentMethod(),
4850 #endif
4851 Expression.Constant(provider, typeof(IQbservableProvider)),
4852 actionAsync
4853 )
4854 );
4855 }
4856 #endif
4857
4858 #if !NO_TPL
4859 /// <summary>
4860 /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
4861 /// </summary>
4862 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4863 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
4864 /// <param name="functionAsync">Asynchronous function to convert.</param>
4865 /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
4866 /// <exception cref="T:System.ArgumentNullException">
4867 /// <paramref name="functionAsync" /> is null.</exception>
4868 public static IQbservable<TResult> FromAsync<TResult>(this IQbservableProvider provider, Expression<Func<Task<TResult>>> functionAsync)
4869 {
4870 if (provider == null)
4871 throw new ArgumentNullException("provider");
4872 if (functionAsync == null)
4873 throw new ArgumentNullException("functionAsync");
4874
4875 return provider.CreateQuery<TResult>(
4876 Expression.Call(
4877 null,
4878 #if CRIPPLED_REFLECTION
4879 InfoOf(() => Qbservable.FromAsync<TResult>(default(IQbservableProvider), default(Expression<Func<Task<TResult>>>))),
4880 #else
4881 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4882 #endif
4883 Expression.Constant(provider, typeof(IQbservableProvider)),
4884 functionAsync
4885 )
4886 );
4887 }
4888 #endif
4889
4890 #if !NO_TPL
4891 /// <summary>
4892 /// Converts to asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started.
4893 /// The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation.
4894 /// </summary>
4895 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4896 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
4897 /// <param name="functionAsync">Asynchronous function to convert.</param>
4898 /// <returns>An observable sequence exposing the result of invoking the function, or an exception.</returns>
4899 /// <exception cref="T:System.ArgumentNullException">
4900 /// <paramref name="functionAsync" /> is null.</exception>
4901 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.</remarks>
4902 public static IQbservable<TResult> FromAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResult>>> functionAsync)
4903 {
4904 if (provider == null)
4905 throw new ArgumentNullException("provider");
4906 if (functionAsync == null)
4907 throw new ArgumentNullException("functionAsync");
4908
4909 return provider.CreateQuery<TResult>(
4910 Expression.Call(
4911 null,
4912 #if CRIPPLED_REFLECTION
4913 InfoOf(() => Qbservable.FromAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResult>>>))),
4914 #else
4915 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
4916 #endif
4917 Expression.Constant(provider, typeof(IQbservableProvider)),
4918 functionAsync
4919 )
4920 );
4921 }
4922 #endif
4923
4924 /// <summary>
4925 /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
4926 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
4927 /// </summary>
4928 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4929 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
4930 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
4931 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
4932 /// <exception cref="T:System.ArgumentNullException">
4933 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
4934 /// <remarks>
4935 /// <para>
4936 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
4937 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
4938 /// </para>
4939 /// <para>
4940 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
4941 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
4942 /// </para>
4943 /// <para>
4944 /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
4945 /// making the Subscribe or Dispose call, respectively.
4946 /// </para>
4947 /// <para>
4948 /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
4949 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
4950 /// more concise and easier to understand.
4951 /// </para>
4952 /// </remarks>
4953 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
4954 public static IQbservable<Unit> FromEvent(this IQbservableProvider provider, Expression<Action<Action>> addHandler, Expression<Action<Action>> removeHandler)
4955 {
4956 if (provider == null)
4957 throw new ArgumentNullException("provider");
4958 if (addHandler == null)
4959 throw new ArgumentNullException("addHandler");
4960 if (removeHandler == null)
4961 throw new ArgumentNullException("removeHandler");
4962
4963 return provider.CreateQuery<Unit>(
4964 Expression.Call(
4965 null,
4966 #if CRIPPLED_REFLECTION
4967 InfoOf(() => Qbservable.FromEvent(default(IQbservableProvider), default(Expression<Action<Action>>), default(Expression<Action<Action>>))),
4968 #else
4969 (MethodInfo)MethodInfo.GetCurrentMethod(),
4970 #endif
4971 Expression.Constant(provider, typeof(IQbservableProvider)),
4972 addHandler,
4973 removeHandler
4974 )
4975 );
4976 }
4977
4978 /// <summary>
4979 /// Converts an Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
4980 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
4981 /// </summary>
4982 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
4983 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
4984 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
4985 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
4986 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
4987 /// <exception cref="T:System.ArgumentNullException">
4988 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
4989 /// <remarks>
4990 /// <para>
4991 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
4992 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
4993 /// </para>
4994 /// <para>
4995 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
4996 /// accessed from the same context, as required by some UI frameworks.
4997 /// </para>
4998 /// <para>
4999 /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5000 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
5001 /// parameter. For more information, see the remarks section on those overloads.
5002 /// </para>
5003 /// </remarks>
5004 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5005 public static IQbservable<Unit> FromEvent(this IQbservableProvider provider, Expression<Action<Action>> addHandler, Expression<Action<Action>> removeHandler, IScheduler scheduler)
5006 {
5007 if (provider == null)
5008 throw new ArgumentNullException("provider");
5009 if (addHandler == null)
5010 throw new ArgumentNullException("addHandler");
5011 if (removeHandler == null)
5012 throw new ArgumentNullException("removeHandler");
5013 if (scheduler == null)
5014 throw new ArgumentNullException("scheduler");
5015
5016 return provider.CreateQuery<Unit>(
5017 Expression.Call(
5018 null,
5019 #if CRIPPLED_REFLECTION
5020 InfoOf(() => Qbservable.FromEvent(default(IQbservableProvider), default(Expression<Action<Action>>), default(Expression<Action<Action>>), default(IScheduler))),
5021 #else
5022 (MethodInfo)MethodInfo.GetCurrentMethod(),
5023 #endif
5024 Expression.Constant(provider, typeof(IQbservableProvider)),
5025 addHandler,
5026 removeHandler,
5027 Expression.Constant(scheduler, typeof(IScheduler))
5028 )
5029 );
5030 }
5031
5032 /// <summary>
5033 /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5034 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5035 /// </summary>
5036 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5037 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
5038 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5039 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5040 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5041 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5042 /// <exception cref="T:System.ArgumentNullException">
5043 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
5044 /// <remarks>
5045 /// <para>
5046 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5047 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5048 /// </para>
5049 /// <para>
5050 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
5051 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5052 /// </para>
5053 /// <para>
5054 /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
5055 /// making the Subscribe or Dispose call, respectively.
5056 /// </para>
5057 /// <para>
5058 /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5059 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5060 /// more concise and easier to understand.
5061 /// </para>
5062 /// </remarks>
5063 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5064 public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
5065 {
5066 if (provider == null)
5067 throw new ArgumentNullException("provider");
5068 if (addHandler == null)
5069 throw new ArgumentNullException("addHandler");
5070 if (removeHandler == null)
5071 throw new ArgumentNullException("removeHandler");
5072
5073 return provider.CreateQuery<TEventArgs>(
5074 Expression.Call(
5075 null,
5076 #if CRIPPLED_REFLECTION
5077 InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
5078 #else
5079 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
5080 #endif
5081 Expression.Constant(provider, typeof(IQbservableProvider)),
5082 addHandler,
5083 removeHandler
5084 )
5085 );
5086 }
5087
5088 /// <summary>
5089 /// Converts a .NET event to an observable sequence, using a supplied event delegate type. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5090 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5091 /// </summary>
5092 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5093 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
5094 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5095 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5096 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5097 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5098 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5099 /// <exception cref="T:System.ArgumentNullException">
5100 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
5101 /// <remarks>
5102 /// <para>
5103 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5104 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5105 /// </para>
5106 /// <para>
5107 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5108 /// accessed from the same context, as required by some UI frameworks.
5109 /// </para>
5110 /// <para>
5111 /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5112 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
5113 /// parameter. For more information, see the remarks section on those overloads.
5114 /// </para>
5115 /// </remarks>
5116 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5117 public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
5118 {
5119 if (provider == null)
5120 throw new ArgumentNullException("provider");
5121 if (addHandler == null)
5122 throw new ArgumentNullException("addHandler");
5123 if (removeHandler == null)
5124 throw new ArgumentNullException("removeHandler");
5125 if (scheduler == null)
5126 throw new ArgumentNullException("scheduler");
5127
5128 return provider.CreateQuery<TEventArgs>(
5129 Expression.Call(
5130 null,
5131 #if CRIPPLED_REFLECTION
5132 InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
5133 #else
5134 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
5135 #endif
5136 Expression.Constant(provider, typeof(IQbservableProvider)),
5137 addHandler,
5138 removeHandler,
5139 Expression.Constant(scheduler, typeof(IScheduler))
5140 )
5141 );
5142 }
5143
5144 /// <summary>
5145 /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5146 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5147 /// </summary>
5148 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5149 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
5150 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5151 /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
5152 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5153 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5154 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5155 /// <exception cref="T:System.ArgumentNullException">
5156 /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
5157 /// <remarks>
5158 /// <para>
5159 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5160 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5161 /// </para>
5162 /// <para>
5163 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
5164 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5165 /// </para>
5166 /// <para>
5167 /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
5168 /// making the Subscribe or Dispose call, respectively.
5169 /// </para>
5170 /// <para>
5171 /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5172 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5173 /// more concise and easier to understand.
5174 /// </para>
5175 /// </remarks>
5176 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5177 public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<Action<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
5178 {
5179 if (provider == null)
5180 throw new ArgumentNullException("provider");
5181 if (conversion == null)
5182 throw new ArgumentNullException("conversion");
5183 if (addHandler == null)
5184 throw new ArgumentNullException("addHandler");
5185 if (removeHandler == null)
5186 throw new ArgumentNullException("removeHandler");
5187
5188 return provider.CreateQuery<TEventArgs>(
5189 Expression.Call(
5190 null,
5191 #if CRIPPLED_REFLECTION
5192 InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<Action<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
5193 #else
5194 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
5195 #endif
5196 Expression.Constant(provider, typeof(IQbservableProvider)),
5197 conversion,
5198 addHandler,
5199 removeHandler
5200 )
5201 );
5202 }
5203
5204 /// <summary>
5205 /// Converts a .NET event to an observable sequence, using a conversion function to obtain the event delegate. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5206 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5207 /// </summary>
5208 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5209 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
5210 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5211 /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
5212 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5213 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5214 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5215 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5216 /// <exception cref="T:System.ArgumentNullException">
5217 /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
5218 /// <remarks>
5219 /// <para>
5220 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5221 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5222 /// </para>
5223 /// <para>
5224 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5225 /// accessed from the same context, as required by some UI frameworks.
5226 /// </para>
5227 /// <para>
5228 /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5229 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
5230 /// parameter. For more information, see the remarks section on those overloads.
5231 /// </para>
5232 /// </remarks>
5233 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5234 public static IQbservable<TEventArgs> FromEvent<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<Action<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
5235 {
5236 if (provider == null)
5237 throw new ArgumentNullException("provider");
5238 if (conversion == null)
5239 throw new ArgumentNullException("conversion");
5240 if (addHandler == null)
5241 throw new ArgumentNullException("addHandler");
5242 if (removeHandler == null)
5243 throw new ArgumentNullException("removeHandler");
5244 if (scheduler == null)
5245 throw new ArgumentNullException("scheduler");
5246
5247 return provider.CreateQuery<TEventArgs>(
5248 Expression.Call(
5249 null,
5250 #if CRIPPLED_REFLECTION
5251 InfoOf(() => Qbservable.FromEvent<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<Action<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
5252 #else
5253 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
5254 #endif
5255 Expression.Constant(provider, typeof(IQbservableProvider)),
5256 conversion,
5257 addHandler,
5258 removeHandler,
5259 Expression.Constant(scheduler, typeof(IScheduler))
5260 )
5261 );
5262 }
5263
5264 /// <summary>
5265 /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5266 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5267 /// </summary>
5268 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5269 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5270 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5271 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5272 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5273 /// <exception cref="T:System.ArgumentNullException">
5274 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
5275 /// <remarks>
5276 /// <para>
5277 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5278 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5279 /// </para>
5280 /// <para>
5281 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEvent, and is used to post add and remove handler invocations.
5282 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5283 /// </para>
5284 /// <para>
5285 /// If no SynchronizationContext is present at the point of calling FromEvent, add and remove handler invocations are made synchronously on the thread
5286 /// making the Subscribe or Dispose call, respectively.
5287 /// </para>
5288 /// <para>
5289 /// It's recommended to lift FromEvent calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5290 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5291 /// more concise and easier to understand.
5292 /// </para>
5293 /// </remarks>
5294 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5295 public static IQbservable<TEventArgs> FromEvent<TEventArgs>(this IQbservableProvider provider, Expression<Action<Action<TEventArgs>>> addHandler, Expression<Action<Action<TEventArgs>>> removeHandler)
5296 {
5297 if (provider == null)
5298 throw new ArgumentNullException("provider");
5299 if (addHandler == null)
5300 throw new ArgumentNullException("addHandler");
5301 if (removeHandler == null)
5302 throw new ArgumentNullException("removeHandler");
5303
5304 return provider.CreateQuery<TEventArgs>(
5305 Expression.Call(
5306 null,
5307 #if CRIPPLED_REFLECTION
5308 InfoOf(() => Qbservable.FromEvent<TEventArgs>(default(IQbservableProvider), default(Expression<Action<Action<TEventArgs>>>), default(Expression<Action<Action<TEventArgs>>>))),
5309 #else
5310 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
5311 #endif
5312 Expression.Constant(provider, typeof(IQbservableProvider)),
5313 addHandler,
5314 removeHandler
5315 )
5316 );
5317 }
5318
5319 /// <summary>
5320 /// Converts a generic Action-based .NET event to an observable sequence. Each event invocation is surfaced through an OnNext message in the resulting sequence.
5321 /// For conversion of events conforming to the standard .NET event pattern, use any of the FromEventPattern overloads instead.
5322 /// </summary>
5323 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5324 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
5325 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5326 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5327 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5328 /// <returns>The observable sequence that contains the event argument objects passed to the invocations of the underlying .NET event.</returns>
5329 /// <exception cref="T:System.ArgumentNullException">
5330 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
5331 /// <remarks>
5332 /// <para>
5333 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5334 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5335 /// </para>
5336 /// <para>
5337 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5338 /// accessed from the same context, as required by some UI frameworks.
5339 /// </para>
5340 /// <para>
5341 /// It's recommended to lift FromEvent calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5342 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEvent that omit the IScheduler
5343 /// parameter. For more information, see the remarks section on those overloads.
5344 /// </para>
5345 /// </remarks>
5346 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEvent(System.IObservable{System.Reactive.Unit})" />
5347 public static IQbservable<TEventArgs> FromEvent<TEventArgs>(this IQbservableProvider provider, Expression<Action<Action<TEventArgs>>> addHandler, Expression<Action<Action<TEventArgs>>> removeHandler, IScheduler scheduler)
5348 {
5349 if (provider == null)
5350 throw new ArgumentNullException("provider");
5351 if (addHandler == null)
5352 throw new ArgumentNullException("addHandler");
5353 if (removeHandler == null)
5354 throw new ArgumentNullException("removeHandler");
5355 if (scheduler == null)
5356 throw new ArgumentNullException("scheduler");
5357
5358 return provider.CreateQuery<TEventArgs>(
5359 Expression.Call(
5360 null,
5361 #if CRIPPLED_REFLECTION
5362 InfoOf(() => Qbservable.FromEvent<TEventArgs>(default(IQbservableProvider), default(Expression<Action<Action<TEventArgs>>>), default(Expression<Action<Action<TEventArgs>>>), default(IScheduler))),
5363 #else
5364 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
5365 #endif
5366 Expression.Constant(provider, typeof(IQbservableProvider)),
5367 addHandler,
5368 removeHandler,
5369 Expression.Constant(scheduler, typeof(IScheduler))
5370 )
5371 );
5372 }
5373
5374 #if !NO_EVENTARGS_CONSTRAINT
5375 /// <summary>
5376 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
5377 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5378 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5379 /// </summary>
5380 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5381 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5382 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5383 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5384 /// <exception cref="T:System.ArgumentNullException">
5385 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
5386 /// <remarks>
5387 /// <para>
5388 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5389 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5390 /// </para>
5391 /// <para>
5392 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5393 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5394 /// </para>
5395 /// <para>
5396 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5397 /// making the Subscribe or Dispose call, respectively.
5398 /// </para>
5399 /// <para>
5400 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5401 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5402 /// more concise and easier to understand.
5403 /// </para>
5404 /// </remarks>
5405 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5406 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler)
5407 {
5408 if (provider == null)
5409 throw new ArgumentNullException("provider");
5410 if (addHandler == null)
5411 throw new ArgumentNullException("addHandler");
5412 if (removeHandler == null)
5413 throw new ArgumentNullException("removeHandler");
5414
5415 return provider.CreateQuery<EventPattern<EventArgs>>(
5416 Expression.Call(
5417 null,
5418 #if CRIPPLED_REFLECTION
5419 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>))),
5420 #else
5421 (MethodInfo)MethodInfo.GetCurrentMethod(),
5422 #endif
5423 Expression.Constant(provider, typeof(IQbservableProvider)),
5424 addHandler,
5425 removeHandler
5426 )
5427 );
5428 }
5429 #else
5430 /// <summary>
5431 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
5432 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5433 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5434 /// </summary>
5435 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5436 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5437 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5438 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5439 /// <exception cref="T:System.ArgumentNullException">
5440 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
5441 /// <remarks>
5442 /// <para>
5443 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5444 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5445 /// </para>
5446 /// <para>
5447 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5448 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5449 /// </para>
5450 /// <para>
5451 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5452 /// making the Subscribe or Dispose call, respectively.
5453 /// </para>
5454 /// <para>
5455 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5456 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5457 /// more concise and easier to understand.
5458 /// </para>
5459 /// </remarks>
5460 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5461 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler)
5462 {
5463 if (provider == null)
5464 throw new ArgumentNullException("provider");
5465 if (addHandler == null)
5466 throw new ArgumentNullException("addHandler");
5467 if (removeHandler == null)
5468 throw new ArgumentNullException("removeHandler");
5469
5470 return provider.CreateQuery<EventPattern<object>>(
5471 Expression.Call(
5472 null,
5473 #if CRIPPLED_REFLECTION
5474 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>))),
5475 #else
5476 (MethodInfo)MethodInfo.GetCurrentMethod(),
5477 #endif
5478 Expression.Constant(provider, typeof(IQbservableProvider)),
5479 addHandler,
5480 removeHandler
5481 )
5482 );
5483 }
5484 #endif
5485
5486 #if !NO_EVENTARGS_CONSTRAINT
5487 /// <summary>
5488 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
5489 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5490 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5491 /// </summary>
5492 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5493 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5494 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5495 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5496 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5497 /// <exception cref="T:System.ArgumentNullException">
5498 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
5499 /// <remarks>
5500 /// <para>
5501 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5502 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5503 /// </para>
5504 /// <para>
5505 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5506 /// accessed from the same context, as required by some UI frameworks.
5507 /// </para>
5508 /// <para>
5509 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5510 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
5511 /// parameter. For more information, see the remarks section on those overloads.
5512 /// </para>
5513 /// </remarks>
5514 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5515 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler, IScheduler scheduler)
5516 {
5517 if (provider == null)
5518 throw new ArgumentNullException("provider");
5519 if (addHandler == null)
5520 throw new ArgumentNullException("addHandler");
5521 if (removeHandler == null)
5522 throw new ArgumentNullException("removeHandler");
5523 if (scheduler == null)
5524 throw new ArgumentNullException("scheduler");
5525
5526 return provider.CreateQuery<EventPattern<EventArgs>>(
5527 Expression.Call(
5528 null,
5529 #if CRIPPLED_REFLECTION
5530 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>), default(IScheduler))),
5531 #else
5532 (MethodInfo)MethodInfo.GetCurrentMethod(),
5533 #endif
5534 Expression.Constant(provider, typeof(IQbservableProvider)),
5535 addHandler,
5536 removeHandler,
5537 Expression.Constant(scheduler, typeof(IScheduler))
5538 )
5539 );
5540 }
5541 #else
5542 /// <summary>
5543 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler" />, to an observable sequence.
5544 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5545 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5546 /// </summary>
5547 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5548 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
5549 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
5550 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5551 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5552 /// <exception cref="T:System.ArgumentNullException">
5553 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
5554 /// <remarks>
5555 /// <para>
5556 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5557 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5558 /// </para>
5559 /// <para>
5560 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5561 /// accessed from the same context, as required by some UI frameworks.
5562 /// </para>
5563 /// <para>
5564 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5565 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
5566 /// parameter. For more information, see the remarks section on those overloads.
5567 /// </para>
5568 /// </remarks>
5569 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5570 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Expression<Action<EventHandler>> addHandler, Expression<Action<EventHandler>> removeHandler, IScheduler scheduler)
5571 {
5572 if (provider == null)
5573 throw new ArgumentNullException("provider");
5574 if (addHandler == null)
5575 throw new ArgumentNullException("addHandler");
5576 if (removeHandler == null)
5577 throw new ArgumentNullException("removeHandler");
5578 if (scheduler == null)
5579 throw new ArgumentNullException("scheduler");
5580
5581 return provider.CreateQuery<EventPattern<object>>(
5582 Expression.Call(
5583 null,
5584 #if CRIPPLED_REFLECTION
5585 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Expression<Action<EventHandler>>), default(Expression<Action<EventHandler>>), default(IScheduler))),
5586 #else
5587 (MethodInfo)MethodInfo.GetCurrentMethod(),
5588 #endif
5589 Expression.Constant(provider, typeof(IQbservableProvider)),
5590 addHandler,
5591 removeHandler,
5592 Expression.Constant(scheduler, typeof(IScheduler))
5593 )
5594 );
5595 }
5596 #endif
5597
5598 #if !NO_EVENTARGS_CONSTRAINT
5599 /// <summary>
5600 /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5601 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5602 /// Reflection is used to discover the event based on the target object type and the specified event name.
5603 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5604 /// </summary>
5605 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5606 /// <param name="target">Object instance that exposes the event to convert.</param>
5607 /// <param name="eventName">Name of the event to convert.</param>
5608 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5609 /// <exception cref="T:System.ArgumentNullException">
5610 /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
5611 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5612 /// <remarks>
5613 /// <para>
5614 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5615 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5616 /// </para>
5617 /// <para>
5618 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5619 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5620 /// </para>
5621 /// <para>
5622 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5623 /// making the Subscribe or Dispose call, respectively.
5624 /// </para>
5625 /// <para>
5626 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5627 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5628 /// more concise and easier to understand.
5629 /// </para>
5630 /// </remarks>
5631 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5632 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, object target, string eventName)
5633 {
5634 if (provider == null)
5635 throw new ArgumentNullException("provider");
5636 if (target == null)
5637 throw new ArgumentNullException("target");
5638 if (eventName == null)
5639 throw new ArgumentNullException("eventName");
5640
5641 return provider.CreateQuery<EventPattern<EventArgs>>(
5642 Expression.Call(
5643 null,
5644 #if CRIPPLED_REFLECTION
5645 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string))),
5646 #else
5647 (MethodInfo)MethodInfo.GetCurrentMethod(),
5648 #endif
5649 Expression.Constant(provider, typeof(IQbservableProvider)),
5650 Expression.Constant(target, typeof(object)),
5651 Expression.Constant(eventName, typeof(string))
5652 )
5653 );
5654 }
5655 #else
5656 /// <summary>
5657 /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5658 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5659 /// Reflection is used to discover the event based on the target object type and the specified event name.
5660 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5661 /// </summary>
5662 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5663 /// <param name="target">Object instance that exposes the event to convert.</param>
5664 /// <param name="eventName">Name of the event to convert.</param>
5665 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5666 /// <exception cref="T:System.ArgumentNullException">
5667 /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
5668 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5669 /// <remarks>
5670 /// <para>
5671 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5672 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5673 /// </para>
5674 /// <para>
5675 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5676 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5677 /// </para>
5678 /// <para>
5679 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5680 /// making the Subscribe or Dispose call, respectively.
5681 /// </para>
5682 /// <para>
5683 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5684 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5685 /// more concise and easier to understand.
5686 /// </para>
5687 /// </remarks>
5688 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5689 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, object target, string eventName)
5690 {
5691 if (provider == null)
5692 throw new ArgumentNullException("provider");
5693 if (target == null)
5694 throw new ArgumentNullException("target");
5695 if (eventName == null)
5696 throw new ArgumentNullException("eventName");
5697
5698 return provider.CreateQuery<EventPattern<object>>(
5699 Expression.Call(
5700 null,
5701 #if CRIPPLED_REFLECTION
5702 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string))),
5703 #else
5704 (MethodInfo)MethodInfo.GetCurrentMethod(),
5705 #endif
5706 Expression.Constant(provider, typeof(IQbservableProvider)),
5707 Expression.Constant(target, typeof(object)),
5708 Expression.Constant(eventName, typeof(string))
5709 )
5710 );
5711 }
5712 #endif
5713
5714 #if !NO_EVENTARGS_CONSTRAINT
5715 /// <summary>
5716 /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5717 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5718 /// Reflection is used to discover the event based on the target object type and the specified event name.
5719 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5720 /// </summary>
5721 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5722 /// <param name="target">Object instance that exposes the event to convert.</param>
5723 /// <param name="eventName">Name of the event to convert.</param>
5724 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5725 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5726 /// <exception cref="T:System.ArgumentNullException">
5727 /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
5728 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5729 /// <remarks>
5730 /// <para>
5731 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5732 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5733 /// </para>
5734 /// <para>
5735 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5736 /// accessed from the same context, as required by some UI frameworks.
5737 /// </para>
5738 /// <para>
5739 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5740 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
5741 /// parameter. For more information, see the remarks section on those overloads.
5742 /// </para>
5743 /// </remarks>
5744 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5745 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
5746 {
5747 if (provider == null)
5748 throw new ArgumentNullException("provider");
5749 if (target == null)
5750 throw new ArgumentNullException("target");
5751 if (eventName == null)
5752 throw new ArgumentNullException("eventName");
5753 if (scheduler == null)
5754 throw new ArgumentNullException("scheduler");
5755
5756 return provider.CreateQuery<EventPattern<EventArgs>>(
5757 Expression.Call(
5758 null,
5759 #if CRIPPLED_REFLECTION
5760 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
5761 #else
5762 (MethodInfo)MethodInfo.GetCurrentMethod(),
5763 #endif
5764 Expression.Constant(provider, typeof(IQbservableProvider)),
5765 Expression.Constant(target, typeof(object)),
5766 Expression.Constant(eventName, typeof(string)),
5767 Expression.Constant(scheduler, typeof(IScheduler))
5768 )
5769 );
5770 }
5771 #else
5772 /// <summary>
5773 /// Converts an instance .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5774 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5775 /// Reflection is used to discover the event based on the target object type and the specified event name.
5776 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5777 /// </summary>
5778 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5779 /// <param name="target">Object instance that exposes the event to convert.</param>
5780 /// <param name="eventName">Name of the event to convert.</param>
5781 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5782 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5783 /// <exception cref="T:System.ArgumentNullException">
5784 /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
5785 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5786 /// <remarks>
5787 /// <para>
5788 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5789 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5790 /// </para>
5791 /// <para>
5792 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5793 /// accessed from the same context, as required by some UI frameworks.
5794 /// </para>
5795 /// <para>
5796 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5797 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
5798 /// parameter. For more information, see the remarks section on those overloads.
5799 /// </para>
5800 /// </remarks>
5801 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5802 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
5803 {
5804 if (provider == null)
5805 throw new ArgumentNullException("provider");
5806 if (target == null)
5807 throw new ArgumentNullException("target");
5808 if (eventName == null)
5809 throw new ArgumentNullException("eventName");
5810 if (scheduler == null)
5811 throw new ArgumentNullException("scheduler");
5812
5813 return provider.CreateQuery<EventPattern<object>>(
5814 Expression.Call(
5815 null,
5816 #if CRIPPLED_REFLECTION
5817 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
5818 #else
5819 (MethodInfo)MethodInfo.GetCurrentMethod(),
5820 #endif
5821 Expression.Constant(provider, typeof(IQbservableProvider)),
5822 Expression.Constant(target, typeof(object)),
5823 Expression.Constant(eventName, typeof(string)),
5824 Expression.Constant(scheduler, typeof(IScheduler))
5825 )
5826 );
5827 }
5828 #endif
5829
5830 #if !NO_EVENTARGS_CONSTRAINT
5831 /// <summary>
5832 /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5833 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5834 /// Reflection is used to discover the event based on the specified type and the specified event name.
5835 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5836 /// </summary>
5837 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5838 /// <param name="type">Type that exposes the static event to convert.</param>
5839 /// <param name="eventName">Name of the event to convert.</param>
5840 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5841 /// <exception cref="T:System.ArgumentNullException">
5842 /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
5843 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5844 /// <remarks>
5845 /// <para>
5846 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5847 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5848 /// </para>
5849 /// <para>
5850 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5851 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5852 /// </para>
5853 /// <para>
5854 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5855 /// making the Subscribe or Dispose call, respectively.
5856 /// </para>
5857 /// <para>
5858 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5859 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5860 /// more concise and easier to understand.
5861 /// </para>
5862 /// </remarks>
5863 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5864 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName)
5865 {
5866 if (provider == null)
5867 throw new ArgumentNullException("provider");
5868 if (type == null)
5869 throw new ArgumentNullException("type");
5870 if (eventName == null)
5871 throw new ArgumentNullException("eventName");
5872
5873 return provider.CreateQuery<EventPattern<EventArgs>>(
5874 Expression.Call(
5875 null,
5876 #if CRIPPLED_REFLECTION
5877 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string))),
5878 #else
5879 (MethodInfo)MethodInfo.GetCurrentMethod(),
5880 #endif
5881 Expression.Constant(provider, typeof(IQbservableProvider)),
5882 Expression.Constant(type, typeof(Type)),
5883 Expression.Constant(eventName, typeof(string))
5884 )
5885 );
5886 }
5887 #else
5888 /// <summary>
5889 /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5890 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5891 /// Reflection is used to discover the event based on the specified type and the specified event name.
5892 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5893 /// </summary>
5894 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5895 /// <param name="type">Type that exposes the static event to convert.</param>
5896 /// <param name="eventName">Name of the event to convert.</param>
5897 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5898 /// <exception cref="T:System.ArgumentNullException">
5899 /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
5900 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5901 /// <remarks>
5902 /// <para>
5903 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5904 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5905 /// </para>
5906 /// <para>
5907 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
5908 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
5909 /// </para>
5910 /// <para>
5911 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
5912 /// making the Subscribe or Dispose call, respectively.
5913 /// </para>
5914 /// <para>
5915 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
5916 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
5917 /// more concise and easier to understand.
5918 /// </para>
5919 /// </remarks>
5920 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5921 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName)
5922 {
5923 if (provider == null)
5924 throw new ArgumentNullException("provider");
5925 if (type == null)
5926 throw new ArgumentNullException("type");
5927 if (eventName == null)
5928 throw new ArgumentNullException("eventName");
5929
5930 return provider.CreateQuery<EventPattern<object>>(
5931 Expression.Call(
5932 null,
5933 #if CRIPPLED_REFLECTION
5934 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string))),
5935 #else
5936 (MethodInfo)MethodInfo.GetCurrentMethod(),
5937 #endif
5938 Expression.Constant(provider, typeof(IQbservableProvider)),
5939 Expression.Constant(type, typeof(Type)),
5940 Expression.Constant(eventName, typeof(string))
5941 )
5942 );
5943 }
5944 #endif
5945
5946 #if !NO_EVENTARGS_CONSTRAINT
5947 /// <summary>
5948 /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
5949 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
5950 /// Reflection is used to discover the event based on the specified type and the specified event name.
5951 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
5952 /// </summary>
5953 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
5954 /// <param name="type">Type that exposes the static event to convert.</param>
5955 /// <param name="eventName">Name of the event to convert.</param>
5956 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
5957 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
5958 /// <exception cref="T:System.ArgumentNullException">
5959 /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
5960 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
5961 /// <remarks>
5962 /// <para>
5963 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
5964 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
5965 /// </para>
5966 /// <para>
5967 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
5968 /// accessed from the same context, as required by some UI frameworks.
5969 /// </para>
5970 /// <para>
5971 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
5972 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
5973 /// parameter. For more information, see the remarks section on those overloads.
5974 /// </para>
5975 /// </remarks>
5976 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
5977 public static IQbservable<EventPattern<EventArgs>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
5978 {
5979 if (provider == null)
5980 throw new ArgumentNullException("provider");
5981 if (type == null)
5982 throw new ArgumentNullException("type");
5983 if (eventName == null)
5984 throw new ArgumentNullException("eventName");
5985 if (scheduler == null)
5986 throw new ArgumentNullException("scheduler");
5987
5988 return provider.CreateQuery<EventPattern<EventArgs>>(
5989 Expression.Call(
5990 null,
5991 #if CRIPPLED_REFLECTION
5992 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
5993 #else
5994 (MethodInfo)MethodInfo.GetCurrentMethod(),
5995 #endif
5996 Expression.Constant(provider, typeof(IQbservableProvider)),
5997 Expression.Constant(type, typeof(Type)),
5998 Expression.Constant(eventName, typeof(string)),
5999 Expression.Constant(scheduler, typeof(IScheduler))
6000 )
6001 );
6002 }
6003 #else
6004 /// <summary>
6005 /// Converts a static .NET event, conforming to the standard .NET event pattern with an <see cref="T:System.EventArgs" /> parameter, to an observable sequence.
6006 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6007 /// Reflection is used to discover the event based on the specified type and the specified event name.
6008 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6009 /// </summary>
6010 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6011 /// <param name="type">Type that exposes the static event to convert.</param>
6012 /// <param name="eventName">Name of the event to convert.</param>
6013 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6014 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6015 /// <exception cref="T:System.ArgumentNullException">
6016 /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
6017 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern.</exception>
6018 /// <remarks>
6019 /// <para>
6020 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6021 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6022 /// </para>
6023 /// <para>
6024 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6025 /// accessed from the same context, as required by some UI frameworks.
6026 /// </para>
6027 /// <para>
6028 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6029 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6030 /// parameter. For more information, see the remarks section on those overloads.
6031 /// </para>
6032 /// </remarks>
6033 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6034 public static IQbservable<EventPattern<object>> FromEventPattern(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
6035 {
6036 if (provider == null)
6037 throw new ArgumentNullException("provider");
6038 if (type == null)
6039 throw new ArgumentNullException("type");
6040 if (eventName == null)
6041 throw new ArgumentNullException("eventName");
6042 if (scheduler == null)
6043 throw new ArgumentNullException("scheduler");
6044
6045 return provider.CreateQuery<EventPattern<object>>(
6046 Expression.Call(
6047 null,
6048 #if CRIPPLED_REFLECTION
6049 InfoOf(() => Qbservable.FromEventPattern(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
6050 #else
6051 (MethodInfo)MethodInfo.GetCurrentMethod(),
6052 #endif
6053 Expression.Constant(provider, typeof(IQbservableProvider)),
6054 Expression.Constant(type, typeof(Type)),
6055 Expression.Constant(eventName, typeof(string)),
6056 Expression.Constant(scheduler, typeof(IScheduler))
6057 )
6058 );
6059 }
6060 #endif
6061
6062 /// <summary>
6063 /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
6064 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6065 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6066 /// </summary>
6067 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6068 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6069 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6070 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6071 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6072 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6073 /// <exception cref="T:System.ArgumentNullException">
6074 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
6075 /// <remarks>
6076 /// <para>
6077 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6078 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6079 /// </para>
6080 /// <para>
6081 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6082 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6083 /// </para>
6084 /// <para>
6085 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6086 /// making the Subscribe or Dispose call, respectively.
6087 /// </para>
6088 /// <para>
6089 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6090 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6091 /// more concise and easier to understand.
6092 /// </para>
6093 /// </remarks>
6094 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6095 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
6096 #if !NO_EVENTARGS_CONSTRAINT
6097 where TEventArgs : EventArgs
6098 #endif
6099 {
6100 if (provider == null)
6101 throw new ArgumentNullException("provider");
6102 if (addHandler == null)
6103 throw new ArgumentNullException("addHandler");
6104 if (removeHandler == null)
6105 throw new ArgumentNullException("removeHandler");
6106
6107 return provider.CreateQuery<EventPattern<TEventArgs>>(
6108 Expression.Call(
6109 null,
6110 #if CRIPPLED_REFLECTION
6111 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
6112 #else
6113 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
6114 #endif
6115 Expression.Constant(provider, typeof(IQbservableProvider)),
6116 addHandler,
6117 removeHandler
6118 )
6119 );
6120 }
6121
6122 /// <summary>
6123 /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type, to an observable sequence.
6124 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6125 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6126 /// </summary>
6127 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6128 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6129 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6130 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6131 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6132 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6133 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6134 /// <exception cref="T:System.ArgumentNullException">
6135 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
6136 /// <remarks>
6137 /// <para>
6138 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6139 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6140 /// </para>
6141 /// <para>
6142 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6143 /// accessed from the same context, as required by some UI frameworks.
6144 /// </para>
6145 /// <para>
6146 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6147 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6148 /// parameter. For more information, see the remarks section on those overloads.
6149 /// </para>
6150 /// </remarks>
6151 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6152 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
6153 #if !NO_EVENTARGS_CONSTRAINT
6154 where TEventArgs : EventArgs
6155 #endif
6156 {
6157 if (provider == null)
6158 throw new ArgumentNullException("provider");
6159 if (addHandler == null)
6160 throw new ArgumentNullException("addHandler");
6161 if (removeHandler == null)
6162 throw new ArgumentNullException("removeHandler");
6163 if (scheduler == null)
6164 throw new ArgumentNullException("scheduler");
6165
6166 return provider.CreateQuery<EventPattern<TEventArgs>>(
6167 Expression.Call(
6168 null,
6169 #if CRIPPLED_REFLECTION
6170 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
6171 #else
6172 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
6173 #endif
6174 Expression.Constant(provider, typeof(IQbservableProvider)),
6175 addHandler,
6176 removeHandler,
6177 Expression.Constant(scheduler, typeof(IScheduler))
6178 )
6179 );
6180 }
6181
6182 /// <summary>
6183 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
6184 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6185 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6186 /// </summary>
6187 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6188 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6189 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6190 /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
6191 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6192 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6193 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6194 /// <exception cref="T:System.ArgumentNullException">
6195 /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
6196 /// <remarks>
6197 /// <para>
6198 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6199 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6200 /// </para>
6201 /// <para>
6202 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6203 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6204 /// </para>
6205 /// <para>
6206 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6207 /// making the Subscribe or Dispose call, respectively.
6208 /// </para>
6209 /// <para>
6210 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6211 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6212 /// more concise and easier to understand.
6213 /// </para>
6214 /// </remarks>
6215 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6216 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<EventHandler<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
6217 #if !NO_EVENTARGS_CONSTRAINT
6218 where TEventArgs : EventArgs
6219 #endif
6220 {
6221 if (provider == null)
6222 throw new ArgumentNullException("provider");
6223 if (conversion == null)
6224 throw new ArgumentNullException("conversion");
6225 if (addHandler == null)
6226 throw new ArgumentNullException("addHandler");
6227 if (removeHandler == null)
6228 throw new ArgumentNullException("removeHandler");
6229
6230 return provider.CreateQuery<EventPattern<TEventArgs>>(
6231 Expression.Call(
6232 null,
6233 #if CRIPPLED_REFLECTION
6234 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<EventHandler<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
6235 #else
6236 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
6237 #endif
6238 Expression.Constant(provider, typeof(IQbservableProvider)),
6239 conversion,
6240 addHandler,
6241 removeHandler
6242 )
6243 );
6244 }
6245
6246 /// <summary>
6247 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
6248 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6249 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6250 /// </summary>
6251 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6252 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6253 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6254 /// <param name="conversion">A function used to convert the given event handler to a delegate compatible with the underlying .NET event. The resulting delegate is used in calls to the addHandler and removeHandler action parameters.</param>
6255 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6256 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6257 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6258 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6259 /// <exception cref="T:System.ArgumentNullException">
6260 /// <paramref name="conversion" /> or <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
6261 /// <remarks>
6262 /// <para>
6263 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6264 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6265 /// </para>
6266 /// <para>
6267 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6268 /// accessed from the same context, as required by some UI frameworks.
6269 /// </para>
6270 /// <para>
6271 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6272 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6273 /// parameter. For more information, see the remarks section on those overloads.
6274 /// </para>
6275 /// </remarks>
6276 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6277 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TDelegate, TEventArgs>(this IQbservableProvider provider, Expression<Func<EventHandler<TEventArgs>, TDelegate>> conversion, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
6278 #if !NO_EVENTARGS_CONSTRAINT
6279 where TEventArgs : EventArgs
6280 #endif
6281 {
6282 if (provider == null)
6283 throw new ArgumentNullException("provider");
6284 if (conversion == null)
6285 throw new ArgumentNullException("conversion");
6286 if (addHandler == null)
6287 throw new ArgumentNullException("addHandler");
6288 if (removeHandler == null)
6289 throw new ArgumentNullException("removeHandler");
6290 if (scheduler == null)
6291 throw new ArgumentNullException("scheduler");
6292
6293 return provider.CreateQuery<EventPattern<TEventArgs>>(
6294 Expression.Call(
6295 null,
6296 #if CRIPPLED_REFLECTION
6297 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TEventArgs>(default(IQbservableProvider), default(Expression<Func<EventHandler<TEventArgs>, TDelegate>>), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
6298 #else
6299 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TEventArgs)),
6300 #endif
6301 Expression.Constant(provider, typeof(IQbservableProvider)),
6302 conversion,
6303 addHandler,
6304 removeHandler,
6305 Expression.Constant(scheduler, typeof(IScheduler))
6306 )
6307 );
6308 }
6309
6310 /// <summary>
6311 /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
6312 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6313 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6314 /// </summary>
6315 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6316 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6317 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6318 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6319 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6320 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6321 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6322 /// <exception cref="T:System.ArgumentNullException">
6323 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> is null.</exception>
6324 /// <remarks>
6325 /// <para>
6326 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6327 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6328 /// </para>
6329 /// <para>
6330 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6331 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6332 /// </para>
6333 /// <para>
6334 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6335 /// making the Subscribe or Dispose call, respectively.
6336 /// </para>
6337 /// <para>
6338 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6339 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6340 /// more concise and easier to understand.
6341 /// </para>
6342 /// </remarks>
6343 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6344 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler)
6345 #if !NO_EVENTARGS_CONSTRAINT
6346 where TEventArgs : EventArgs
6347 #endif
6348 {
6349 if (provider == null)
6350 throw new ArgumentNullException("provider");
6351 if (addHandler == null)
6352 throw new ArgumentNullException("addHandler");
6353 if (removeHandler == null)
6354 throw new ArgumentNullException("removeHandler");
6355
6356 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
6357 Expression.Call(
6358 null,
6359 #if CRIPPLED_REFLECTION
6360 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TSender, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>))),
6361 #else
6362 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TSender), typeof(TEventArgs)),
6363 #endif
6364 Expression.Constant(provider, typeof(IQbservableProvider)),
6365 addHandler,
6366 removeHandler
6367 )
6368 );
6369 }
6370
6371 /// <summary>
6372 /// Converts a .NET event, conforming to the standard .NET event pattern based on a supplied event delegate type with a strongly typed sender parameter, to an observable sequence.
6373 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6374 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6375 /// </summary>
6376 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6377 /// <typeparam name="TDelegate">The delegate type of the event to be converted.</typeparam>
6378 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6379 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6380 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6381 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6382 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6383 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6384 /// <exception cref="T:System.ArgumentNullException">
6385 /// <paramref name="addHandler" /> or <paramref name="removeHandler" /> or <paramref name="scheduler" /> is null.</exception>
6386 /// <remarks>
6387 /// <para>
6388 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6389 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6390 /// </para>
6391 /// <para>
6392 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6393 /// accessed from the same context, as required by some UI frameworks.
6394 /// </para>
6395 /// <para>
6396 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6397 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6398 /// parameter. For more information, see the remarks section on those overloads.
6399 /// </para>
6400 /// </remarks>
6401 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6402 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TDelegate, TSender, TEventArgs>(this IQbservableProvider provider, Expression<Action<TDelegate>> addHandler, Expression<Action<TDelegate>> removeHandler, IScheduler scheduler)
6403 #if !NO_EVENTARGS_CONSTRAINT
6404 where TEventArgs : EventArgs
6405 #endif
6406 {
6407 if (provider == null)
6408 throw new ArgumentNullException("provider");
6409 if (addHandler == null)
6410 throw new ArgumentNullException("addHandler");
6411 if (removeHandler == null)
6412 throw new ArgumentNullException("removeHandler");
6413 if (scheduler == null)
6414 throw new ArgumentNullException("scheduler");
6415
6416 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
6417 Expression.Call(
6418 null,
6419 #if CRIPPLED_REFLECTION
6420 InfoOf(() => Qbservable.FromEventPattern<TDelegate, TSender, TEventArgs>(default(IQbservableProvider), default(Expression<Action<TDelegate>>), default(Expression<Action<TDelegate>>), default(IScheduler))),
6421 #else
6422 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TDelegate), typeof(TSender), typeof(TEventArgs)),
6423 #endif
6424 Expression.Constant(provider, typeof(IQbservableProvider)),
6425 addHandler,
6426 removeHandler,
6427 Expression.Constant(scheduler, typeof(IScheduler))
6428 )
6429 );
6430 }
6431
6432 /// <summary>
6433 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
6434 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6435 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6436 /// </summary>
6437 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6438 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6439 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6440 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6441 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6442 /// <remarks>
6443 /// <para>
6444 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6445 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6446 /// </para>
6447 /// <para>
6448 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6449 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6450 /// </para>
6451 /// <para>
6452 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6453 /// making the Subscribe or Dispose call, respectively.
6454 /// </para>
6455 /// <para>
6456 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6457 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6458 /// more concise and easier to understand.
6459 /// </para>
6460 /// </remarks>
6461 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6462 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Expression<Action<EventHandler<TEventArgs>>> addHandler, Expression<Action<EventHandler<TEventArgs>>> removeHandler)
6463 #if !NO_EVENTARGS_CONSTRAINT
6464 where TEventArgs : EventArgs
6465 #endif
6466 {
6467 if (provider == null)
6468 throw new ArgumentNullException("provider");
6469 if (addHandler == null)
6470 throw new ArgumentNullException("addHandler");
6471 if (removeHandler == null)
6472 throw new ArgumentNullException("removeHandler");
6473
6474 return provider.CreateQuery<EventPattern<TEventArgs>>(
6475 Expression.Call(
6476 null,
6477 #if CRIPPLED_REFLECTION
6478 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Expression<Action<EventHandler<TEventArgs>>>), default(Expression<Action<EventHandler<TEventArgs>>>))),
6479 #else
6480 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6481 #endif
6482 Expression.Constant(provider, typeof(IQbservableProvider)),
6483 addHandler,
6484 removeHandler
6485 )
6486 );
6487 }
6488
6489 /// <summary>
6490 /// Converts a .NET event, conforming to the standard .NET event pattern based on <see cref="T:System.EventHandler`1" />, to an observable sequence.
6491 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6492 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6493 /// </summary>
6494 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6495 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6496 /// <param name="addHandler">Action that attaches the given event handler to the underlying .NET event.</param>
6497 /// <param name="removeHandler">Action that detaches the given event handler from the underlying .NET event.</param>
6498 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6499 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6500 /// <remarks>
6501 /// <para>
6502 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6503 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6504 /// </para>
6505 /// <para>
6506 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6507 /// accessed from the same context, as required by some UI frameworks.
6508 /// </para>
6509 /// <para>
6510 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6511 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6512 /// parameter. For more information, see the remarks section on those overloads.
6513 /// </para>
6514 /// </remarks>
6515 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6516 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Expression<Action<EventHandler<TEventArgs>>> addHandler, Expression<Action<EventHandler<TEventArgs>>> removeHandler, IScheduler scheduler)
6517 #if !NO_EVENTARGS_CONSTRAINT
6518 where TEventArgs : EventArgs
6519 #endif
6520 {
6521 if (provider == null)
6522 throw new ArgumentNullException("provider");
6523 if (addHandler == null)
6524 throw new ArgumentNullException("addHandler");
6525 if (removeHandler == null)
6526 throw new ArgumentNullException("removeHandler");
6527 if (scheduler == null)
6528 throw new ArgumentNullException("scheduler");
6529
6530 return provider.CreateQuery<EventPattern<TEventArgs>>(
6531 Expression.Call(
6532 null,
6533 #if CRIPPLED_REFLECTION
6534 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Expression<Action<EventHandler<TEventArgs>>>), default(Expression<Action<EventHandler<TEventArgs>>>), default(IScheduler))),
6535 #else
6536 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6537 #endif
6538 Expression.Constant(provider, typeof(IQbservableProvider)),
6539 addHandler,
6540 removeHandler,
6541 Expression.Constant(scheduler, typeof(IScheduler))
6542 )
6543 );
6544 }
6545
6546 /// <summary>
6547 /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
6548 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6549 /// Reflection is used to discover the event based on the target object type and the specified event name.
6550 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6551 /// </summary>
6552 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6553 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6554 /// <param name="target">Object instance that exposes the event to convert.</param>
6555 /// <param name="eventName">Name of the event to convert.</param>
6556 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6557 /// <exception cref="T:System.ArgumentNullException">
6558 /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
6559 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6560 /// <remarks>
6561 /// <para>
6562 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6563 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6564 /// </para>
6565 /// <para>
6566 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6567 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6568 /// </para>
6569 /// <para>
6570 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6571 /// making the Subscribe or Dispose call, respectively.
6572 /// </para>
6573 /// <para>
6574 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6575 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6576 /// more concise and easier to understand.
6577 /// </para>
6578 /// </remarks>
6579 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6580 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, object target, string eventName)
6581 #if !NO_EVENTARGS_CONSTRAINT
6582 where TEventArgs : EventArgs
6583 #endif
6584 {
6585 if (provider == null)
6586 throw new ArgumentNullException("provider");
6587 if (target == null)
6588 throw new ArgumentNullException("target");
6589 if (eventName == null)
6590 throw new ArgumentNullException("eventName");
6591
6592 return provider.CreateQuery<EventPattern<TEventArgs>>(
6593 Expression.Call(
6594 null,
6595 #if CRIPPLED_REFLECTION
6596 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(object), default(string))),
6597 #else
6598 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6599 #endif
6600 Expression.Constant(provider, typeof(IQbservableProvider)),
6601 Expression.Constant(target, typeof(object)),
6602 Expression.Constant(eventName, typeof(string))
6603 )
6604 );
6605 }
6606
6607 /// <summary>
6608 /// Converts an instance .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
6609 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6610 /// Reflection is used to discover the event based on the target object type and the specified event name.
6611 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6612 /// </summary>
6613 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6614 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6615 /// <param name="target">Object instance that exposes the event to convert.</param>
6616 /// <param name="eventName">Name of the event to convert.</param>
6617 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6618 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6619 /// <exception cref="T:System.ArgumentNullException">
6620 /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
6621 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6622 /// <remarks>
6623 /// <para>
6624 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6625 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6626 /// </para>
6627 /// <para>
6628 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6629 /// accessed from the same context, as required by some UI frameworks.
6630 /// </para>
6631 /// <para>
6632 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6633 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6634 /// parameter. For more information, see the remarks section on those overloads.
6635 /// </para>
6636 /// </remarks>
6637 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6638 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
6639 #if !NO_EVENTARGS_CONSTRAINT
6640 where TEventArgs : EventArgs
6641 #endif
6642 {
6643 if (provider == null)
6644 throw new ArgumentNullException("provider");
6645 if (target == null)
6646 throw new ArgumentNullException("target");
6647 if (eventName == null)
6648 throw new ArgumentNullException("eventName");
6649 if (scheduler == null)
6650 throw new ArgumentNullException("scheduler");
6651
6652 return provider.CreateQuery<EventPattern<TEventArgs>>(
6653 Expression.Call(
6654 null,
6655 #if CRIPPLED_REFLECTION
6656 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
6657 #else
6658 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6659 #endif
6660 Expression.Constant(provider, typeof(IQbservableProvider)),
6661 Expression.Constant(target, typeof(object)),
6662 Expression.Constant(eventName, typeof(string)),
6663 Expression.Constant(scheduler, typeof(IScheduler))
6664 )
6665 );
6666 }
6667
6668 /// <summary>
6669 /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
6670 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6671 /// Reflection is used to discover the event based on the specified type and the specified event name.
6672 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6673 /// </summary>
6674 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6675 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6676 /// <param name="type">Type that exposes the static event to convert.</param>
6677 /// <param name="eventName">Name of the event to convert.</param>
6678 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6679 /// <exception cref="T:System.ArgumentNullException">
6680 /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
6681 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6682 /// <remarks>
6683 /// <para>
6684 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6685 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6686 /// </para>
6687 /// <para>
6688 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6689 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6690 /// </para>
6691 /// <para>
6692 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6693 /// making the Subscribe or Dispose call, respectively.
6694 /// </para>
6695 /// <para>
6696 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6697 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6698 /// more concise and easier to understand.
6699 /// </para>
6700 /// </remarks>
6701 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6702 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Type type, string eventName)
6703 #if !NO_EVENTARGS_CONSTRAINT
6704 where TEventArgs : EventArgs
6705 #endif
6706 {
6707 if (provider == null)
6708 throw new ArgumentNullException("provider");
6709 if (type == null)
6710 throw new ArgumentNullException("type");
6711 if (eventName == null)
6712 throw new ArgumentNullException("eventName");
6713
6714 return provider.CreateQuery<EventPattern<TEventArgs>>(
6715 Expression.Call(
6716 null,
6717 #if CRIPPLED_REFLECTION
6718 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Type), default(string))),
6719 #else
6720 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6721 #endif
6722 Expression.Constant(provider, typeof(IQbservableProvider)),
6723 Expression.Constant(type, typeof(Type)),
6724 Expression.Constant(eventName, typeof(string))
6725 )
6726 );
6727 }
6728
6729 /// <summary>
6730 /// Converts a static .NET event, conforming to the standard .NET event pattern with strongly typed event arguments, to an observable sequence.
6731 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6732 /// Reflection is used to discover the event based on the specified type and the specified event name.
6733 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6734 /// </summary>
6735 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6736 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6737 /// <param name="type">Type that exposes the static event to convert.</param>
6738 /// <param name="eventName">Name of the event to convert.</param>
6739 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6740 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6741 /// <exception cref="T:System.ArgumentNullException">
6742 /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
6743 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6744 /// <remarks>
6745 /// <para>
6746 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6747 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6748 /// </para>
6749 /// <para>
6750 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6751 /// accessed from the same context, as required by some UI frameworks.
6752 /// </para>
6753 /// <para>
6754 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6755 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6756 /// parameter. For more information, see the remarks section on those overloads.
6757 /// </para>
6758 /// </remarks>
6759 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6760 public static IQbservable<EventPattern<TEventArgs>> FromEventPattern<TEventArgs>(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
6761 #if !NO_EVENTARGS_CONSTRAINT
6762 where TEventArgs : EventArgs
6763 #endif
6764 {
6765 if (provider == null)
6766 throw new ArgumentNullException("provider");
6767 if (type == null)
6768 throw new ArgumentNullException("type");
6769 if (eventName == null)
6770 throw new ArgumentNullException("eventName");
6771 if (scheduler == null)
6772 throw new ArgumentNullException("scheduler");
6773
6774 return provider.CreateQuery<EventPattern<TEventArgs>>(
6775 Expression.Call(
6776 null,
6777 #if CRIPPLED_REFLECTION
6778 InfoOf(() => Qbservable.FromEventPattern<TEventArgs>(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
6779 #else
6780 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TEventArgs)),
6781 #endif
6782 Expression.Constant(provider, typeof(IQbservableProvider)),
6783 Expression.Constant(type, typeof(Type)),
6784 Expression.Constant(eventName, typeof(string)),
6785 Expression.Constant(scheduler, typeof(IScheduler))
6786 )
6787 );
6788 }
6789
6790 /// <summary>
6791 /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
6792 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6793 /// Reflection is used to discover the event based on the target object type and the specified event name.
6794 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6795 /// </summary>
6796 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6797 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6798 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6799 /// <param name="target">Object instance that exposes the event to convert.</param>
6800 /// <param name="eventName">Name of the event to convert.</param>
6801 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6802 /// <exception cref="T:System.ArgumentNullException">
6803 /// <paramref name="target" /> or <paramref name="eventName" /> is null.</exception>
6804 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6805 /// <remarks>
6806 /// <para>
6807 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6808 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6809 /// </para>
6810 /// <para>
6811 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6812 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6813 /// </para>
6814 /// <para>
6815 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6816 /// making the Subscribe or Dispose call, respectively.
6817 /// </para>
6818 /// <para>
6819 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6820 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6821 /// more concise and easier to understand.
6822 /// </para>
6823 /// </remarks>
6824 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6825 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, object target, string eventName)
6826 #if !NO_EVENTARGS_CONSTRAINT
6827 where TEventArgs : EventArgs
6828 #endif
6829 {
6830 if (provider == null)
6831 throw new ArgumentNullException("provider");
6832 if (target == null)
6833 throw new ArgumentNullException("target");
6834 if (eventName == null)
6835 throw new ArgumentNullException("eventName");
6836
6837 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
6838 Expression.Call(
6839 null,
6840 #if CRIPPLED_REFLECTION
6841 InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(object), default(string))),
6842 #else
6843 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
6844 #endif
6845 Expression.Constant(provider, typeof(IQbservableProvider)),
6846 Expression.Constant(target, typeof(object)),
6847 Expression.Constant(eventName, typeof(string))
6848 )
6849 );
6850 }
6851
6852 /// <summary>
6853 /// Converts an instance .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
6854 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6855 /// Reflection is used to discover the event based on the target object type and the specified event name.
6856 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6857 /// </summary>
6858 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6859 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6860 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6861 /// <param name="target">Object instance that exposes the event to convert.</param>
6862 /// <param name="eventName">Name of the event to convert.</param>
6863 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6864 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6865 /// <exception cref="T:System.ArgumentNullException">
6866 /// <paramref name="target" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
6867 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6868 /// <remarks>
6869 /// <para>
6870 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6871 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6872 /// </para>
6873 /// <para>
6874 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6875 /// accessed from the same context, as required by some UI frameworks.
6876 /// </para>
6877 /// <para>
6878 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
6879 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
6880 /// parameter. For more information, see the remarks section on those overloads.
6881 /// </para>
6882 /// </remarks>
6883 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6884 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, object target, string eventName, IScheduler scheduler)
6885 #if !NO_EVENTARGS_CONSTRAINT
6886 where TEventArgs : EventArgs
6887 #endif
6888 {
6889 if (provider == null)
6890 throw new ArgumentNullException("provider");
6891 if (target == null)
6892 throw new ArgumentNullException("target");
6893 if (eventName == null)
6894 throw new ArgumentNullException("eventName");
6895 if (scheduler == null)
6896 throw new ArgumentNullException("scheduler");
6897
6898 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
6899 Expression.Call(
6900 null,
6901 #if CRIPPLED_REFLECTION
6902 InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(object), default(string), default(IScheduler))),
6903 #else
6904 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
6905 #endif
6906 Expression.Constant(provider, typeof(IQbservableProvider)),
6907 Expression.Constant(target, typeof(object)),
6908 Expression.Constant(eventName, typeof(string)),
6909 Expression.Constant(scheduler, typeof(IScheduler))
6910 )
6911 );
6912 }
6913
6914 /// <summary>
6915 /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
6916 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6917 /// Reflection is used to discover the event based on the specified type and the specified event name.
6918 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6919 /// </summary>
6920 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6921 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6922 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6923 /// <param name="type">Type that exposes the static event to convert.</param>
6924 /// <param name="eventName">Name of the event to convert.</param>
6925 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6926 /// <exception cref="T:System.ArgumentNullException">
6927 /// <paramref name="type" /> or <paramref name="eventName" /> is null.</exception>
6928 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6929 /// <remarks>
6930 /// <para>
6931 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6932 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6933 /// </para>
6934 /// <para>
6935 /// The current <see cref="T:System.Threading.SynchronizationContext" /> is captured during the call to FromEventPattern, and is used to post add and remove handler invocations.
6936 /// This behavior ensures add and remove handler operations for thread-affine events are accessed from the same context, as required by some UI frameworks.
6937 /// </para>
6938 /// <para>
6939 /// If no SynchronizationContext is present at the point of calling FromEventPattern, add and remove handler invocations are made synchronously on the thread
6940 /// making the Subscribe or Dispose call, respectively.
6941 /// </para>
6942 /// <para>
6943 /// It's recommended to lift FromEventPattern calls outside event stream query expressions due to the free-threaded nature of Reactive Extensions. Doing so
6944 /// makes the captured SynchronizationContext predictable. This best practice also reduces clutter of bridging code inside queries, making the query expressions
6945 /// more concise and easier to understand.
6946 /// </para>
6947 /// </remarks>
6948 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
6949 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, Type type, string eventName)
6950 #if !NO_EVENTARGS_CONSTRAINT
6951 where TEventArgs : EventArgs
6952 #endif
6953 {
6954 if (provider == null)
6955 throw new ArgumentNullException("provider");
6956 if (type == null)
6957 throw new ArgumentNullException("type");
6958 if (eventName == null)
6959 throw new ArgumentNullException("eventName");
6960
6961 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
6962 Expression.Call(
6963 null,
6964 #if CRIPPLED_REFLECTION
6965 InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(Type), default(string))),
6966 #else
6967 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
6968 #endif
6969 Expression.Constant(provider, typeof(IQbservableProvider)),
6970 Expression.Constant(type, typeof(Type)),
6971 Expression.Constant(eventName, typeof(string))
6972 )
6973 );
6974 }
6975
6976 /// <summary>
6977 /// Converts a static .NET event, conforming to the standard .NET event pattern with a strongly typed sender and strongly typed event arguments, to an observable sequence.
6978 /// Each event invocation is surfaced through an OnNext message in the resulting sequence.
6979 /// Reflection is used to discover the event based on the specified type and the specified event name.
6980 /// For conversion of events that don't conform to the standard .NET event pattern, use any of the FromEvent overloads instead.
6981 /// </summary>
6982 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
6983 /// <typeparam name="TSender">The type of the sender that raises the event.</typeparam>
6984 /// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
6985 /// <param name="type">Type that exposes the static event to convert.</param>
6986 /// <param name="eventName">Name of the event to convert.</param>
6987 /// <param name="scheduler">The scheduler to run the add and remove event handler logic on.</param>
6988 /// <returns>The observable sequence that contains data representations of invocations of the underlying .NET event.</returns>
6989 /// <exception cref="T:System.ArgumentNullException">
6990 /// <paramref name="type" /> or <paramref name="eventName" /> or <paramref name="scheduler" /> is null.</exception>
6991 /// <exception cref="T:System.InvalidOperationException">The event could not be found. -or- The event does not conform to the standard .NET event pattern. -or- The event's first argument type is not assignable to TSender. -or- The event's second argument type is not assignable to TEventArgs.</exception>
6992 /// <remarks>
6993 /// <para>
6994 /// Add and remove handler invocations are made whenever the number of observers grows beyond zero.
6995 /// As such, an event handler may be shared by multiple simultaneously active observers, using a subject for multicasting.
6996 /// </para>
6997 /// <para>
6998 /// Add and remove handler invocations are run on the specified scheduler. This behavior allows add and remove handler operations for thread-affine events to be
6999 /// accessed from the same context, as required by some UI frameworks.
7000 /// </para>
7001 /// <para>
7002 /// It's recommended to lift FromEventPattern calls outside event stream query expressions. This best practice reduces clutter of bridging code inside queries,
7003 /// making the query expressions more concise and easier to understand. This has additional benefits for overloads of FromEventPattern that omit the IScheduler
7004 /// parameter. For more information, see the remarks section on those overloads.
7005 /// </para>
7006 /// </remarks>
7007 /// <seealso cref="M:System.Reactive.Linq.Observable.ToEventPattern``1(System.IObservable{System.Reactive.EventPattern{``0}})" />
7008 public static IQbservable<EventPattern<TSender, TEventArgs>> FromEventPattern<TSender, TEventArgs>(this IQbservableProvider provider, Type type, string eventName, IScheduler scheduler)
7009 #if !NO_EVENTARGS_CONSTRAINT
7010 where TEventArgs : EventArgs
7011 #endif
7012 {
7013 if (provider == null)
7014 throw new ArgumentNullException("provider");
7015 if (type == null)
7016 throw new ArgumentNullException("type");
7017 if (eventName == null)
7018 throw new ArgumentNullException("eventName");
7019 if (scheduler == null)
7020 throw new ArgumentNullException("scheduler");
7021
7022 return provider.CreateQuery<EventPattern<TSender, TEventArgs>>(
7023 Expression.Call(
7024 null,
7025 #if CRIPPLED_REFLECTION
7026 InfoOf(() => Qbservable.FromEventPattern<TSender, TEventArgs>(default(IQbservableProvider), default(Type), default(string), default(IScheduler))),
7027 #else
7028 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSender), typeof(TEventArgs)),
7029 #endif
7030 Expression.Constant(provider, typeof(IQbservableProvider)),
7031 Expression.Constant(type, typeof(Type)),
7032 Expression.Constant(eventName, typeof(string)),
7033 Expression.Constant(scheduler, typeof(IScheduler))
7034 )
7035 );
7036 }
7037
7038 /// <summary>
7039 /// Generates an observable sequence by running a state-driven loop producing the sequence's elements.
7040 /// </summary>
7041 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7042 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7043 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7044 /// <param name="initialState">Initial state.</param>
7045 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7046 /// <param name="iterate">Iteration step function.</param>
7047 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7048 /// <returns>The generated sequence.</returns>
7049 /// <exception cref="T:System.ArgumentNullException">
7050 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> is null.</exception>
7051 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector)
7052 {
7053 if (provider == null)
7054 throw new ArgumentNullException("provider");
7055 if (condition == null)
7056 throw new ArgumentNullException("condition");
7057 if (iterate == null)
7058 throw new ArgumentNullException("iterate");
7059 if (resultSelector == null)
7060 throw new ArgumentNullException("resultSelector");
7061
7062 return provider.CreateQuery<TResult>(
7063 Expression.Call(
7064 null,
7065 #if CRIPPLED_REFLECTION
7066 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>))),
7067 #else
7068 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7069 #endif
7070 Expression.Constant(provider, typeof(IQbservableProvider)),
7071 Expression.Constant(initialState, typeof(TState)),
7072 condition,
7073 iterate,
7074 resultSelector
7075 )
7076 );
7077 }
7078
7079 /// <summary>
7080 /// Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
7081 /// </summary>
7082 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7083 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7084 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7085 /// <param name="initialState">Initial state.</param>
7086 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7087 /// <param name="iterate">Iteration step function.</param>
7088 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7089 /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
7090 /// <returns>The generated sequence.</returns>
7091 /// <exception cref="T:System.ArgumentNullException">
7092 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="scheduler" /> is null.</exception>
7093 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, IScheduler scheduler)
7094 {
7095 if (provider == null)
7096 throw new ArgumentNullException("provider");
7097 if (condition == null)
7098 throw new ArgumentNullException("condition");
7099 if (iterate == null)
7100 throw new ArgumentNullException("iterate");
7101 if (resultSelector == null)
7102 throw new ArgumentNullException("resultSelector");
7103 if (scheduler == null)
7104 throw new ArgumentNullException("scheduler");
7105
7106 return provider.CreateQuery<TResult>(
7107 Expression.Call(
7108 null,
7109 #if CRIPPLED_REFLECTION
7110 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(IScheduler))),
7111 #else
7112 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7113 #endif
7114 Expression.Constant(provider, typeof(IQbservableProvider)),
7115 Expression.Constant(initialState, typeof(TState)),
7116 condition,
7117 iterate,
7118 resultSelector,
7119 Expression.Constant(scheduler, typeof(IScheduler))
7120 )
7121 );
7122 }
7123
7124 /// <summary>
7125 /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
7126 /// </summary>
7127 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7128 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7129 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7130 /// <param name="initialState">Initial state.</param>
7131 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7132 /// <param name="iterate">Iteration step function.</param>
7133 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7134 /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
7135 /// <returns>The generated sequence.</returns>
7136 /// <exception cref="T:System.ArgumentNullException">
7137 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> is null.</exception>
7138 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, TimeSpan>> timeSelector)
7139 {
7140 if (provider == null)
7141 throw new ArgumentNullException("provider");
7142 if (condition == null)
7143 throw new ArgumentNullException("condition");
7144 if (iterate == null)
7145 throw new ArgumentNullException("iterate");
7146 if (resultSelector == null)
7147 throw new ArgumentNullException("resultSelector");
7148 if (timeSelector == null)
7149 throw new ArgumentNullException("timeSelector");
7150
7151 return provider.CreateQuery<TResult>(
7152 Expression.Call(
7153 null,
7154 #if CRIPPLED_REFLECTION
7155 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, TimeSpan>>))),
7156 #else
7157 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7158 #endif
7159 Expression.Constant(provider, typeof(IQbservableProvider)),
7160 Expression.Constant(initialState, typeof(TState)),
7161 condition,
7162 iterate,
7163 resultSelector,
7164 timeSelector
7165 )
7166 );
7167 }
7168
7169 /// <summary>
7170 /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements.
7171 /// </summary>
7172 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7173 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7174 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7175 /// <param name="initialState">Initial state.</param>
7176 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7177 /// <param name="iterate">Iteration step function.</param>
7178 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7179 /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
7180 /// <returns>The generated sequence.</returns>
7181 /// <exception cref="T:System.ArgumentNullException">
7182 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> is null.</exception>
7183 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, DateTimeOffset>> timeSelector)
7184 {
7185 if (provider == null)
7186 throw new ArgumentNullException("provider");
7187 if (condition == null)
7188 throw new ArgumentNullException("condition");
7189 if (iterate == null)
7190 throw new ArgumentNullException("iterate");
7191 if (resultSelector == null)
7192 throw new ArgumentNullException("resultSelector");
7193 if (timeSelector == null)
7194 throw new ArgumentNullException("timeSelector");
7195
7196 return provider.CreateQuery<TResult>(
7197 Expression.Call(
7198 null,
7199 #if CRIPPLED_REFLECTION
7200 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, DateTimeOffset>>))),
7201 #else
7202 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7203 #endif
7204 Expression.Constant(provider, typeof(IQbservableProvider)),
7205 Expression.Constant(initialState, typeof(TState)),
7206 condition,
7207 iterate,
7208 resultSelector,
7209 timeSelector
7210 )
7211 );
7212 }
7213
7214 /// <summary>
7215 /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
7216 /// </summary>
7217 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7218 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7219 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7220 /// <param name="initialState">Initial state.</param>
7221 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7222 /// <param name="iterate">Iteration step function.</param>
7223 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7224 /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
7225 /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
7226 /// <returns>The generated sequence.</returns>
7227 /// <exception cref="T:System.ArgumentNullException">
7228 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> or <paramref name="scheduler" /> is null.</exception>
7229 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, TimeSpan>> timeSelector, IScheduler scheduler)
7230 {
7231 if (provider == null)
7232 throw new ArgumentNullException("provider");
7233 if (condition == null)
7234 throw new ArgumentNullException("condition");
7235 if (iterate == null)
7236 throw new ArgumentNullException("iterate");
7237 if (resultSelector == null)
7238 throw new ArgumentNullException("resultSelector");
7239 if (timeSelector == null)
7240 throw new ArgumentNullException("timeSelector");
7241 if (scheduler == null)
7242 throw new ArgumentNullException("scheduler");
7243
7244 return provider.CreateQuery<TResult>(
7245 Expression.Call(
7246 null,
7247 #if CRIPPLED_REFLECTION
7248 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, TimeSpan>>), default(IScheduler))),
7249 #else
7250 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7251 #endif
7252 Expression.Constant(provider, typeof(IQbservableProvider)),
7253 Expression.Constant(initialState, typeof(TState)),
7254 condition,
7255 iterate,
7256 resultSelector,
7257 timeSelector,
7258 Expression.Constant(scheduler, typeof(IScheduler))
7259 )
7260 );
7261 }
7262
7263 /// <summary>
7264 /// Generates an observable sequence by running a state-driven and temporal loop producing the sequence's elements, using the specified scheduler to run timers and to send out observer messages.
7265 /// </summary>
7266 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
7267 /// <typeparam name="TState">The type of the state used in the generator loop.</typeparam>
7268 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
7269 /// <param name="initialState">Initial state.</param>
7270 /// <param name="condition">Condition to terminate generation (upon returning false).</param>
7271 /// <param name="iterate">Iteration step function.</param>
7272 /// <param name="resultSelector">Selector function for results produced in the sequence.</param>
7273 /// <param name="timeSelector">Time selector function to control the speed of values being produced each iteration.</param>
7274 /// <param name="scheduler">Scheduler on which to run the generator loop.</param>
7275 /// <returns>The generated sequence.</returns>
7276 /// <exception cref="T:System.ArgumentNullException">
7277 /// <paramref name="condition" /> or <paramref name="iterate" /> or <paramref name="resultSelector" /> or <paramref name="timeSelector" /> or <paramref name="scheduler" /> is null.</exception>
7278 public static IQbservable<TResult> Generate<TState, TResult>(this IQbservableProvider provider, TState initialState, Expression<Func<TState, bool>> condition, Expression<Func<TState, TState>> iterate, Expression<Func<TState, TResult>> resultSelector, Expression<Func<TState, DateTimeOffset>> timeSelector, IScheduler scheduler)
7279 {
7280 if (provider == null)
7281 throw new ArgumentNullException("provider");
7282 if (condition == null)
7283 throw new ArgumentNullException("condition");
7284 if (iterate == null)
7285 throw new ArgumentNullException("iterate");
7286 if (resultSelector == null)
7287 throw new ArgumentNullException("resultSelector");
7288 if (timeSelector == null)
7289 throw new ArgumentNullException("timeSelector");
7290 if (scheduler == null)
7291 throw new ArgumentNullException("scheduler");
7292
7293 return provider.CreateQuery<TResult>(
7294 Expression.Call(
7295 null,
7296 #if CRIPPLED_REFLECTION
7297 InfoOf(() => Qbservable.Generate<TState, TResult>(default(IQbservableProvider), default(TState), default(Expression<Func<TState, bool>>), default(Expression<Func<TState, TState>>), default(Expression<Func<TState, TResult>>), default(Expression<Func<TState, DateTimeOffset>>), default(IScheduler))),
7298 #else
7299 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)),
7300 #endif
7301 Expression.Constant(provider, typeof(IQbservableProvider)),
7302 Expression.Constant(initialState, typeof(TState)),
7303 condition,
7304 iterate,
7305 resultSelector,
7306 timeSelector,
7307 Expression.Constant(scheduler, typeof(IScheduler))
7308 )
7309 );
7310 }
7311
7312 /// <summary>
7313 /// Groups the elements of an observable sequence according to a specified key selector function.
7314 /// </summary>
7315 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7316 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7317 /// <param name="source">An observable sequence whose elements to group.</param>
7318 /// <param name="keySelector">A function to extract the key for each element.</param>
7319 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7320 /// <exception cref="T:System.ArgumentNullException">
7321 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
7322 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
7323 {
7324 if (source == null)
7325 throw new ArgumentNullException("source");
7326 if (keySelector == null)
7327 throw new ArgumentNullException("keySelector");
7328
7329 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7330 Expression.Call(
7331 null,
7332 #if CRIPPLED_REFLECTION
7333 InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
7334 #else
7335 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
7336 #endif
7337 source.Expression,
7338 keySelector
7339 )
7340 );
7341 }
7342
7343 /// <summary>
7344 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
7345 /// </summary>
7346 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7347 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7348 /// <param name="source">An observable sequence whose elements to group.</param>
7349 /// <param name="keySelector">A function to extract the key for each element.</param>
7350 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7351 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7352 /// <exception cref="T:System.ArgumentNullException">
7353 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
7354 /// <exception cref="T:System.ArgumentOutOfRangeException">
7355 /// <paramref name="capacity" /> is less than 0.</exception>
7356 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int capacity)
7357 {
7358 if (source == null)
7359 throw new ArgumentNullException("source");
7360 if (keySelector == null)
7361 throw new ArgumentNullException("keySelector");
7362
7363 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7364 Expression.Call(
7365 null,
7366 #if CRIPPLED_REFLECTION
7367 InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(int))),
7368 #else
7369 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
7370 #endif
7371 source.Expression,
7372 keySelector,
7373 Expression.Constant(capacity, typeof(int))
7374 )
7375 );
7376 }
7377
7378 /// <summary>
7379 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
7380 /// </summary>
7381 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7382 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7383 /// <param name="source">An observable sequence whose elements to group.</param>
7384 /// <param name="keySelector">A function to extract the key for each element.</param>
7385 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7386 /// <param name="comparer">An equality comparer to compare keys with.</param>
7387 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7388 /// <exception cref="T:System.ArgumentNullException">
7389 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
7390 /// <exception cref="T:System.ArgumentOutOfRangeException">
7391 /// <paramref name="capacity" /> is less than 0.</exception>
7392 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, int capacity, IEqualityComparer<TKey> comparer)
7393 {
7394 if (source == null)
7395 throw new ArgumentNullException("source");
7396 if (keySelector == null)
7397 throw new ArgumentNullException("keySelector");
7398 if (comparer == null)
7399 throw new ArgumentNullException("comparer");
7400
7401 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7402 Expression.Call(
7403 null,
7404 #if CRIPPLED_REFLECTION
7405 InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(int), default(IEqualityComparer<TKey>))),
7406 #else
7407 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
7408 #endif
7409 source.Expression,
7410 keySelector,
7411 Expression.Constant(capacity, typeof(int)),
7412 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7413 )
7414 );
7415 }
7416
7417 /// <summary>
7418 /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
7419 /// </summary>
7420 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7421 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7422 /// <param name="source">An observable sequence whose elements to group.</param>
7423 /// <param name="keySelector">A function to extract the key for each element.</param>
7424 /// <param name="comparer">An equality comparer to compare keys with.</param>
7425 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7426 /// <exception cref="T:System.ArgumentNullException">
7427 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
7428 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
7429 {
7430 if (source == null)
7431 throw new ArgumentNullException("source");
7432 if (keySelector == null)
7433 throw new ArgumentNullException("keySelector");
7434 if (comparer == null)
7435 throw new ArgumentNullException("comparer");
7436
7437 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7438 Expression.Call(
7439 null,
7440 #if CRIPPLED_REFLECTION
7441 InfoOf(() => Qbservable.GroupBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
7442 #else
7443 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
7444 #endif
7445 source.Expression,
7446 keySelector,
7447 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7448 )
7449 );
7450 }
7451
7452 /// <summary>
7453 /// Groups the elements of an observable sequence and selects the resulting elements by using a specified function.
7454 /// </summary>
7455 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7456 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7457 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7458 /// <param name="source">An observable sequence whose elements to group.</param>
7459 /// <param name="keySelector">A function to extract the key for each element.</param>
7460 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7461 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7462 /// <exception cref="T:System.ArgumentNullException">
7463 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
7464 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
7465 {
7466 if (source == null)
7467 throw new ArgumentNullException("source");
7468 if (keySelector == null)
7469 throw new ArgumentNullException("keySelector");
7470 if (elementSelector == null)
7471 throw new ArgumentNullException("elementSelector");
7472
7473 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7474 Expression.Call(
7475 null,
7476 #if CRIPPLED_REFLECTION
7477 InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
7478 #else
7479 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
7480 #endif
7481 source.Expression,
7482 keySelector,
7483 elementSelector
7484 )
7485 );
7486 }
7487
7488 /// <summary>
7489 /// Groups the elements of an observable sequence with the specified initial capacity and selects the resulting elements by using a specified function.
7490 /// </summary>
7491 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7492 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7493 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7494 /// <param name="source">An observable sequence whose elements to group.</param>
7495 /// <param name="keySelector">A function to extract the key for each element.</param>
7496 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7497 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7498 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7499 /// <exception cref="T:System.ArgumentNullException">
7500 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
7501 /// <exception cref="T:System.ArgumentOutOfRangeException">
7502 /// <paramref name="capacity" /> is less than 0.</exception>
7503 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, int capacity)
7504 {
7505 if (source == null)
7506 throw new ArgumentNullException("source");
7507 if (keySelector == null)
7508 throw new ArgumentNullException("keySelector");
7509 if (elementSelector == null)
7510 throw new ArgumentNullException("elementSelector");
7511
7512 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7513 Expression.Call(
7514 null,
7515 #if CRIPPLED_REFLECTION
7516 InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(int))),
7517 #else
7518 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
7519 #endif
7520 source.Expression,
7521 keySelector,
7522 elementSelector,
7523 Expression.Constant(capacity, typeof(int))
7524 )
7525 );
7526 }
7527
7528 /// <summary>
7529 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
7530 /// </summary>
7531 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7532 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7533 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7534 /// <param name="source">An observable sequence whose elements to group.</param>
7535 /// <param name="keySelector">A function to extract the key for each element.</param>
7536 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7537 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7538 /// <param name="comparer">An equality comparer to compare keys with.</param>
7539 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7540 /// <exception cref="T:System.ArgumentNullException">
7541 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
7542 /// <exception cref="T:System.ArgumentOutOfRangeException">
7543 /// <paramref name="capacity" /> is less than 0.</exception>
7544 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, int capacity, IEqualityComparer<TKey> comparer)
7545 {
7546 if (source == null)
7547 throw new ArgumentNullException("source");
7548 if (keySelector == null)
7549 throw new ArgumentNullException("keySelector");
7550 if (elementSelector == null)
7551 throw new ArgumentNullException("elementSelector");
7552 if (comparer == null)
7553 throw new ArgumentNullException("comparer");
7554
7555 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7556 Expression.Call(
7557 null,
7558 #if CRIPPLED_REFLECTION
7559 InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(int), default(IEqualityComparer<TKey>))),
7560 #else
7561 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
7562 #endif
7563 source.Expression,
7564 keySelector,
7565 elementSelector,
7566 Expression.Constant(capacity, typeof(int)),
7567 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7568 )
7569 );
7570 }
7571
7572 /// <summary>
7573 /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
7574 /// </summary>
7575 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7576 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7577 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7578 /// <param name="source">An observable sequence whose elements to group.</param>
7579 /// <param name="keySelector">A function to extract the key for each element.</param>
7580 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7581 /// <param name="comparer">An equality comparer to compare keys with.</param>
7582 /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
7583 /// <exception cref="T:System.ArgumentNullException">
7584 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
7585 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
7586 {
7587 if (source == null)
7588 throw new ArgumentNullException("source");
7589 if (keySelector == null)
7590 throw new ArgumentNullException("keySelector");
7591 if (elementSelector == null)
7592 throw new ArgumentNullException("elementSelector");
7593 if (comparer == null)
7594 throw new ArgumentNullException("comparer");
7595
7596 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7597 Expression.Call(
7598 null,
7599 #if CRIPPLED_REFLECTION
7600 InfoOf(() => Qbservable.GroupBy<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
7601 #else
7602 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
7603 #endif
7604 source.Expression,
7605 keySelector,
7606 elementSelector,
7607 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7608 )
7609 );
7610 }
7611
7612 /// <summary>
7613 /// Groups the elements of an observable sequence according to a specified key selector function.
7614 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7615 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7616 /// </summary>
7617 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7618 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7619 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7620 /// <param name="source">An observable sequence whose elements to group.</param>
7621 /// <param name="keySelector">A function to extract the key for each element.</param>
7622 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7623 /// <returns>
7624 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7625 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7626 /// </returns>
7627 /// <exception cref="T:System.ArgumentNullException">
7628 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> is null.</exception>
7629 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector)
7630 {
7631 if (source == null)
7632 throw new ArgumentNullException("source");
7633 if (keySelector == null)
7634 throw new ArgumentNullException("keySelector");
7635 if (durationSelector == null)
7636 throw new ArgumentNullException("durationSelector");
7637
7638 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7639 Expression.Call(
7640 null,
7641 #if CRIPPLED_REFLECTION
7642 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>))),
7643 #else
7644 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
7645 #endif
7646 source.Expression,
7647 keySelector,
7648 durationSelector
7649 )
7650 );
7651 }
7652
7653 /// <summary>
7654 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
7655 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7656 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7657 /// </summary>
7658 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7659 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7660 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7661 /// <param name="source">An observable sequence whose elements to group.</param>
7662 /// <param name="keySelector">A function to extract the key for each element.</param>
7663 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7664 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7665 /// <returns>
7666 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7667 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7668 /// </returns>
7669 /// <exception cref="T:System.ArgumentNullException">
7670 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> is null.</exception>
7671 /// <exception cref="T:System.ArgumentOutOfRangeException">
7672 /// <paramref name="capacity" /> is less than 0.</exception>
7673 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector, int capacity)
7674 {
7675 if (source == null)
7676 throw new ArgumentNullException("source");
7677 if (keySelector == null)
7678 throw new ArgumentNullException("keySelector");
7679 if (durationSelector == null)
7680 throw new ArgumentNullException("durationSelector");
7681
7682 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7683 Expression.Call(
7684 null,
7685 #if CRIPPLED_REFLECTION
7686 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>), default(int))),
7687 #else
7688 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
7689 #endif
7690 source.Expression,
7691 keySelector,
7692 durationSelector,
7693 Expression.Constant(capacity, typeof(int))
7694 )
7695 );
7696 }
7697
7698 /// <summary>
7699 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
7700 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7701 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7702 /// </summary>
7703 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7704 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7705 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7706 /// <param name="source">An observable sequence whose elements to group.</param>
7707 /// <param name="keySelector">A function to extract the key for each element.</param>
7708 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7709 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7710 /// <param name="comparer">An equality comparer to compare keys with.</param>
7711 /// <returns>
7712 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7713 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7714 /// </returns>
7715 /// <exception cref="T:System.ArgumentNullException">
7716 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
7717 /// <exception cref="T:System.ArgumentOutOfRangeException">
7718 /// <paramref name="capacity" /> is less than 0.</exception>
7719 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector, int capacity, IEqualityComparer<TKey> comparer)
7720 {
7721 if (source == null)
7722 throw new ArgumentNullException("source");
7723 if (keySelector == null)
7724 throw new ArgumentNullException("keySelector");
7725 if (durationSelector == null)
7726 throw new ArgumentNullException("durationSelector");
7727 if (comparer == null)
7728 throw new ArgumentNullException("comparer");
7729
7730 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7731 Expression.Call(
7732 null,
7733 #if CRIPPLED_REFLECTION
7734 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>), default(int), default(IEqualityComparer<TKey>))),
7735 #else
7736 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
7737 #endif
7738 source.Expression,
7739 keySelector,
7740 durationSelector,
7741 Expression.Constant(capacity, typeof(int)),
7742 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7743 )
7744 );
7745 }
7746
7747 /// <summary>
7748 /// Groups the elements of an observable sequence according to a specified key selector function and comparer.
7749 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7750 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7751 /// </summary>
7752 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7753 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7754 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7755 /// <param name="source">An observable sequence whose elements to group.</param>
7756 /// <param name="keySelector">A function to extract the key for each element.</param>
7757 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7758 /// <param name="comparer">An equality comparer to compare keys with.</param>
7759 /// <returns>
7760 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7761 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7762 /// </returns>
7763 /// <exception cref="T:System.ArgumentNullException">
7764 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
7765 public static IQbservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>> durationSelector, IEqualityComparer<TKey> comparer)
7766 {
7767 if (source == null)
7768 throw new ArgumentNullException("source");
7769 if (keySelector == null)
7770 throw new ArgumentNullException("keySelector");
7771 if (durationSelector == null)
7772 throw new ArgumentNullException("durationSelector");
7773 if (comparer == null)
7774 throw new ArgumentNullException("comparer");
7775
7776 return source.Provider.CreateQuery<IGroupedObservable<TKey, TSource>>(
7777 Expression.Call(
7778 null,
7779 #if CRIPPLED_REFLECTION
7780 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>>>), default(IEqualityComparer<TKey>))),
7781 #else
7782 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TDuration)),
7783 #endif
7784 source.Expression,
7785 keySelector,
7786 durationSelector,
7787 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7788 )
7789 );
7790 }
7791
7792 /// <summary>
7793 /// Groups the elements of an observable sequence according to a specified key selector function and selects the resulting elements by using a specified function.
7794 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7795 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7796 /// </summary>
7797 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7798 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7799 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7800 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7801 /// <param name="source">An observable sequence whose elements to group.</param>
7802 /// <param name="keySelector">A function to extract the key for each element.</param>
7803 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7804 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7805 /// <returns>
7806 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7807 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7808 /// </returns>
7809 /// <exception cref="T:System.ArgumentNullException">
7810 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> is null.</exception>
7811 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector)
7812 {
7813 if (source == null)
7814 throw new ArgumentNullException("source");
7815 if (keySelector == null)
7816 throw new ArgumentNullException("keySelector");
7817 if (elementSelector == null)
7818 throw new ArgumentNullException("elementSelector");
7819 if (durationSelector == null)
7820 throw new ArgumentNullException("durationSelector");
7821
7822 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7823 Expression.Call(
7824 null,
7825 #if CRIPPLED_REFLECTION
7826 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>))),
7827 #else
7828 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
7829 #endif
7830 source.Expression,
7831 keySelector,
7832 elementSelector,
7833 durationSelector
7834 )
7835 );
7836 }
7837
7838 /// <summary>
7839 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and selects the resulting elements by using a specified function.
7840 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7841 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7842 /// </summary>
7843 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7844 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7845 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7846 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7847 /// <param name="source">An observable sequence whose elements to group.</param>
7848 /// <param name="keySelector">A function to extract the key for each element.</param>
7849 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7850 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7851 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7852 /// <returns>
7853 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7854 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
7855 /// </returns>
7856 /// <exception cref="T:System.ArgumentNullException">
7857 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> is null.</exception>
7858 /// <exception cref="T:System.ArgumentOutOfRangeException">
7859 /// <paramref name="capacity" /> is less than 0.</exception>
7860 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector, int capacity)
7861 {
7862 if (source == null)
7863 throw new ArgumentNullException("source");
7864 if (keySelector == null)
7865 throw new ArgumentNullException("keySelector");
7866 if (elementSelector == null)
7867 throw new ArgumentNullException("elementSelector");
7868 if (durationSelector == null)
7869 throw new ArgumentNullException("durationSelector");
7870
7871 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7872 Expression.Call(
7873 null,
7874 #if CRIPPLED_REFLECTION
7875 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>), default(int))),
7876 #else
7877 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
7878 #endif
7879 source.Expression,
7880 keySelector,
7881 elementSelector,
7882 durationSelector,
7883 Expression.Constant(capacity, typeof(int))
7884 )
7885 );
7886 }
7887
7888 /// <summary>
7889 /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
7890 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7891 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7892 /// </summary>
7893 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7894 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7895 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7896 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7897 /// <param name="source">An observable sequence whose elements to group.</param>
7898 /// <param name="keySelector">A function to extract the key for each element.</param>
7899 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7900 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7901 /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
7902 /// <param name="comparer">An equality comparer to compare keys with.</param>
7903 /// <returns>
7904 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7905 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
7906 /// </returns>
7907 /// <exception cref="T:System.ArgumentNullException">
7908 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
7909 /// <exception cref="T:System.ArgumentOutOfRangeException">
7910 /// <paramref name="capacity" /> is less than 0.</exception>
7911 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector, int capacity, IEqualityComparer<TKey> comparer)
7912 {
7913 if (source == null)
7914 throw new ArgumentNullException("source");
7915 if (keySelector == null)
7916 throw new ArgumentNullException("keySelector");
7917 if (elementSelector == null)
7918 throw new ArgumentNullException("elementSelector");
7919 if (durationSelector == null)
7920 throw new ArgumentNullException("durationSelector");
7921 if (comparer == null)
7922 throw new ArgumentNullException("comparer");
7923
7924 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7925 Expression.Call(
7926 null,
7927 #if CRIPPLED_REFLECTION
7928 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>), default(int), default(IEqualityComparer<TKey>))),
7929 #else
7930 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
7931 #endif
7932 source.Expression,
7933 keySelector,
7934 elementSelector,
7935 durationSelector,
7936 Expression.Constant(capacity, typeof(int)),
7937 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7938 )
7939 );
7940 }
7941
7942 /// <summary>
7943 /// Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
7944 /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
7945 /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
7946 /// </summary>
7947 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
7948 /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
7949 /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
7950 /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
7951 /// <param name="source">An observable sequence whose elements to group.</param>
7952 /// <param name="keySelector">A function to extract the key for each element.</param>
7953 /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
7954 /// <param name="durationSelector">A function to signal the expiration of a group.</param>
7955 /// <param name="comparer">An equality comparer to compare keys with.</param>
7956 /// <returns>
7957 /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
7958 /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
7959 /// </returns>
7960 /// <exception cref="T:System.ArgumentNullException">
7961 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="durationSelector" /> or <paramref name="comparer" /> is null.</exception>
7962 public static IQbservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>> durationSelector, IEqualityComparer<TKey> comparer)
7963 {
7964 if (source == null)
7965 throw new ArgumentNullException("source");
7966 if (keySelector == null)
7967 throw new ArgumentNullException("keySelector");
7968 if (elementSelector == null)
7969 throw new ArgumentNullException("elementSelector");
7970 if (durationSelector == null)
7971 throw new ArgumentNullException("durationSelector");
7972 if (comparer == null)
7973 throw new ArgumentNullException("comparer");
7974
7975 return source.Provider.CreateQuery<IGroupedObservable<TKey, TElement>>(
7976 Expression.Call(
7977 null,
7978 #if CRIPPLED_REFLECTION
7979 InfoOf(() => Qbservable.GroupByUntil<TSource, TKey, TElement, TDuration>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>>>), default(IEqualityComparer<TKey>))),
7980 #else
7981 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TDuration)),
7982 #endif
7983 source.Expression,
7984 keySelector,
7985 elementSelector,
7986 durationSelector,
7987 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
7988 )
7989 );
7990 }
7991
7992 /// <summary>
7993 /// Correlates the elements of two sequences based on overlapping durations, and groups the results.
7994 /// </summary>
7995 /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
7996 /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
7997 /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
7998 /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
7999 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
8000 /// <param name="left">The left observable sequence to join elements for.</param>
8001 /// <param name="right">The right observable sequence to join elements for.</param>
8002 /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
8003 /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
8004 /// <param name="resultSelector">A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence.</param>
8005 /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
8006 /// <exception cref="T:System.ArgumentNullException">
8007 /// <paramref name="left" /> or <paramref name="right" /> or <paramref name="leftDurationSelector" /> or <paramref name="rightDurationSelector" /> or <paramref name="resultSelector" /> is null.</exception>
8008 public static IQbservable<TResult> GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IQbservable<TLeft> left, IObservable<TRight> right, Expression<Func<TLeft, IObservable<TLeftDuration>>> leftDurationSelector, Expression<Func<TRight, IObservable<TRightDuration>>> rightDurationSelector, Expression<Func<TLeft, IObservable<TRight>, TResult>> resultSelector)
8009 {
8010 if (left == null)
8011 throw new ArgumentNullException("left");
8012 if (right == null)
8013 throw new ArgumentNullException("right");
8014 if (leftDurationSelector == null)
8015 throw new ArgumentNullException("leftDurationSelector");
8016 if (rightDurationSelector == null)
8017 throw new ArgumentNullException("rightDurationSelector");
8018 if (resultSelector == null)
8019 throw new ArgumentNullException("resultSelector");
8020
8021 return left.Provider.CreateQuery<TResult>(
8022 Expression.Call(
8023 null,
8024 #if CRIPPLED_REFLECTION
8025 InfoOf(() => Qbservable.GroupJoin<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(default(IQbservable<TLeft>), default(IObservable<TRight>), default(Expression<Func<TLeft, IObservable<TLeftDuration>>>), default(Expression<Func<TRight, IObservable<TRightDuration>>>), default(Expression<Func<TLeft, IObservable<TRight>, TResult>>))),
8026 #else
8027 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight), typeof(TLeftDuration), typeof(TRightDuration), typeof(TResult)),
8028 #endif
8029 left.Expression,
8030 GetSourceExpression(right),
8031 leftDurationSelector,
8032 rightDurationSelector,
8033 resultSelector
8034 )
8035 );
8036 }
8037
8038 /// <summary>
8039 /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, return an empty sequence.
8040 /// </summary>
8041 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
8042 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
8043 /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
8044 /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
8045 /// <returns>
8046 /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; an empty sequence otherwise.</returns>
8047 /// <exception cref="T:System.ArgumentNullException">
8048 /// <paramref name="condition" /> or <paramref name="thenSource" /> is null.</exception>
8049 public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource)
8050 {
8051 if (provider == null)
8052 throw new ArgumentNullException("provider");
8053 if (condition == null)
8054 throw new ArgumentNullException("condition");
8055 if (thenSource == null)
8056 throw new ArgumentNullException("thenSource");
8057
8058 return provider.CreateQuery<TResult>(
8059 Expression.Call(
8060 null,
8061 #if CRIPPLED_REFLECTION
8062 InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>))),
8063 #else
8064 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
8065 #endif
8066 Expression.Constant(provider, typeof(IQbservableProvider)),
8067 condition,
8068 GetSourceExpression(thenSource)
8069 )
8070 );
8071 }
8072
8073 /// <summary>
8074 /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, select the <paramref name="elseSource" /> sequence.
8075 /// </summary>
8076 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
8077 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
8078 /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
8079 /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
8080 /// <param name="elseSource">Sequence returned in case <paramref name="condition" /> evaluates false.</param>
8081 /// <returns>
8082 /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; <paramref name="elseSource" /> otherwise.</returns>
8083 /// <exception cref="T:System.ArgumentNullException">
8084 /// <paramref name="condition" /> or <paramref name="thenSource" /> or <paramref name="elseSource" /> is null.</exception>
8085 public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
8086 {
8087 if (provider == null)
8088 throw new ArgumentNullException("provider");
8089 if (condition == null)
8090 throw new ArgumentNullException("condition");
8091 if (thenSource == null)
8092 throw new ArgumentNullException("thenSource");
8093 if (elseSource == null)
8094 throw new ArgumentNullException("elseSource");
8095
8096 return provider.CreateQuery<TResult>(
8097 Expression.Call(
8098 null,
8099 #if CRIPPLED_REFLECTION
8100 InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>), default(IObservable<TResult>))),
8101 #else
8102 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
8103 #endif
8104 Expression.Constant(provider, typeof(IQbservableProvider)),
8105 condition,
8106 GetSourceExpression(thenSource),
8107 GetSourceExpression(elseSource)
8108 )
8109 );
8110 }
8111
8112 /// <summary>
8113 /// If the specified <paramref name="condition" /> evaluates true, select the <paramref name="thenSource" /> sequence. Otherwise, return an empty sequence generated on the specified scheduler.
8114 /// </summary>
8115 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
8116 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
8117 /// <param name="condition">Condition evaluated to decide which sequence to return.</param>
8118 /// <param name="thenSource">Sequence returned in case <paramref name="condition" /> evaluates true.</param>
8119 /// <param name="scheduler">Scheduler to generate an empty sequence on in case <paramref name="condition" /> evaluates false.</param>
8120 /// <returns>
8121 /// <paramref name="thenSource" /> if <paramref name="condition" /> evaluates true; an empty sequence otherwise.</returns>
8122 /// <exception cref="T:System.ArgumentNullException">
8123 /// <paramref name="condition" /> or <paramref name="thenSource" /> or <paramref name="scheduler" /> is null.</exception>
8124 public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IScheduler scheduler)
8125 {
8126 if (provider == null)
8127 throw new ArgumentNullException("provider");
8128 if (condition == null)
8129 throw new ArgumentNullException("condition");
8130 if (thenSource == null)
8131 throw new ArgumentNullException("thenSource");
8132 if (scheduler == null)
8133 throw new ArgumentNullException("scheduler");
8134
8135 return provider.CreateQuery<TResult>(
8136 Expression.Call(
8137 null,
8138 #if CRIPPLED_REFLECTION
8139 InfoOf(() => Qbservable.If<TResult>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TResult>), default(IScheduler))),
8140 #else
8141 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
8142 #endif
8143 Expression.Constant(provider, typeof(IQbservableProvider)),
8144 condition,
8145 GetSourceExpression(thenSource),
8146 Expression.Constant(scheduler, typeof(IScheduler))
8147 )
8148 );
8149 }
8150
8151 /// <summary>
8152 /// Ignores all elements in an observable sequence leaving only the termination messages.
8153 /// </summary>
8154 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8155 /// <param name="source">Source sequence.</param>
8156 /// <returns>An empty observable sequence that signals termination, successful or exceptional, of the source sequence.</returns>
8157 /// <exception cref="T:System.ArgumentNullException">
8158 /// <paramref name="source" /> is null.</exception>
8159 public static IQbservable<TSource> IgnoreElements<TSource>(this IQbservable<TSource> source)
8160 {
8161 if (source == null)
8162 throw new ArgumentNullException("source");
8163
8164 return source.Provider.CreateQuery<TSource>(
8165 Expression.Call(
8166 null,
8167 #if CRIPPLED_REFLECTION
8168 InfoOf(() => Qbservable.IgnoreElements<TSource>(default(IQbservable<TSource>))),
8169 #else
8170 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8171 #endif
8172 source.Expression
8173 )
8174 );
8175 }
8176
8177 /// <summary>
8178 /// Returns an observable sequence that produces a value after each period.
8179 /// </summary>
8180 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
8181 /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
8182 /// <returns>An observable sequence that produces a value after each period.</returns>
8183 /// <exception cref="T:System.ArgumentOutOfRangeException">
8184 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
8185 /// <remarks>
8186 /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
8187 /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
8188 /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
8189 /// <see cref="M:System.Reactive.Linq.Observable.Generate``2(``0,System.Func{``0,System.Boolean},System.Func{``0,``0},System.Func{``0,``1},System.Func{``0,System.TimeSpan})" />
8190 /// operator instead.
8191 /// </remarks>
8192 public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period)
8193 {
8194 if (provider == null)
8195 throw new ArgumentNullException("provider");
8196
8197 return provider.CreateQuery<long>(
8198 Expression.Call(
8199 null,
8200 #if CRIPPLED_REFLECTION
8201 InfoOf(() => Qbservable.Interval(default(IQbservableProvider), default(TimeSpan))),
8202 #else
8203 (MethodInfo)MethodInfo.GetCurrentMethod(),
8204 #endif
8205 Expression.Constant(provider, typeof(IQbservableProvider)),
8206 Expression.Constant(period, typeof(TimeSpan))
8207 )
8208 );
8209 }
8210
8211 /// <summary>
8212 /// Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.
8213 /// </summary>
8214 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
8215 /// <param name="period">Period for producing the values in the resulting sequence. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
8216 /// <param name="scheduler">Scheduler to run the timer on.</param>
8217 /// <returns>An observable sequence that produces a value after each period.</returns>
8218 /// <exception cref="T:System.ArgumentOutOfRangeException">
8219 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
8220 /// <exception cref="T:System.ArgumentNullException">
8221 /// <paramref name="scheduler" /> is null.</exception>
8222 /// <remarks>
8223 /// Intervals are measured between the start of subsequent notifications, not between the end of the previous and the start of the next notification.
8224 /// If the observer takes longer than the interval period to handle the message, the subsequent notification will be delivered immediately after the
8225 /// current one has been handled. In case you need to control the time between the end and the start of consecutive notifications, consider using the
8226 /// <see cref="M:System.Reactive.Linq.Observable.Generate``2(``0,System.Func{``0,System.Boolean},System.Func{``0,``0},System.Func{``0,``1},System.Func{``0,System.TimeSpan},System.Reactive.Concurrency.IScheduler)" />
8227 /// operator instead.
8228 /// </remarks>
8229 public static IQbservable<long> Interval(this IQbservableProvider provider, TimeSpan period, IScheduler scheduler)
8230 {
8231 if (provider == null)
8232 throw new ArgumentNullException("provider");
8233 if (scheduler == null)
8234 throw new ArgumentNullException("scheduler");
8235
8236 return provider.CreateQuery<long>(
8237 Expression.Call(
8238 null,
8239 #if CRIPPLED_REFLECTION
8240 InfoOf(() => Qbservable.Interval(default(IQbservableProvider), default(TimeSpan), default(IScheduler))),
8241 #else
8242 (MethodInfo)MethodInfo.GetCurrentMethod(),
8243 #endif
8244 Expression.Constant(provider, typeof(IQbservableProvider)),
8245 Expression.Constant(period, typeof(TimeSpan)),
8246 Expression.Constant(scheduler, typeof(IScheduler))
8247 )
8248 );
8249 }
8250
8251 /// <summary>
8252 /// Determines whether an observable sequence is empty.
8253 /// </summary>
8254 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8255 /// <param name="source">An observable sequence to check for emptiness.</param>
8256 /// <returns>An observable sequence containing a single element determining whether the source sequence is empty.</returns>
8257 /// <exception cref="T:System.ArgumentNullException">
8258 /// <paramref name="source" /> is null.</exception>
8259 public static IQbservable<bool> IsEmpty<TSource>(this IQbservable<TSource> source)
8260 {
8261 if (source == null)
8262 throw new ArgumentNullException("source");
8263
8264 return source.Provider.CreateQuery<bool>(
8265 Expression.Call(
8266 null,
8267 #if CRIPPLED_REFLECTION
8268 InfoOf(() => Qbservable.IsEmpty<TSource>(default(IQbservable<TSource>))),
8269 #else
8270 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8271 #endif
8272 source.Expression
8273 )
8274 );
8275 }
8276
8277 /// <summary>
8278 /// Correlates the elements of two sequences based on overlapping durations.
8279 /// </summary>
8280 /// <typeparam name="TLeft">The type of the elements in the left source sequence.</typeparam>
8281 /// <typeparam name="TRight">The type of the elements in the right source sequence.</typeparam>
8282 /// <typeparam name="TLeftDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the left source sequence.</typeparam>
8283 /// <typeparam name="TRightDuration">The type of the elements in the duration sequence denoting the computed duration of each element in the right source sequence.</typeparam>
8284 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by invoking the result selector function for source elements with overlapping duration.</typeparam>
8285 /// <param name="left">The left observable sequence to join elements for.</param>
8286 /// <param name="right">The right observable sequence to join elements for.</param>
8287 /// <param name="leftDurationSelector">A function to select the duration of each element of the left observable sequence, used to determine overlap.</param>
8288 /// <param name="rightDurationSelector">A function to select the duration of each element of the right observable sequence, used to determine overlap.</param>
8289 /// <param name="resultSelector">A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences.</param>
8290 /// <returns>An observable sequence that contains result elements computed from source elements that have an overlapping duration.</returns>
8291 /// <exception cref="T:System.ArgumentNullException">
8292 /// <paramref name="left" /> or <paramref name="right" /> or <paramref name="leftDurationSelector" /> or <paramref name="rightDurationSelector" /> or <paramref name="resultSelector" /> is null.</exception>
8293 public static IQbservable<TResult> Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(this IQbservable<TLeft> left, IObservable<TRight> right, Expression<Func<TLeft, IObservable<TLeftDuration>>> leftDurationSelector, Expression<Func<TRight, IObservable<TRightDuration>>> rightDurationSelector, Expression<Func<TLeft, TRight, TResult>> resultSelector)
8294 {
8295 if (left == null)
8296 throw new ArgumentNullException("left");
8297 if (right == null)
8298 throw new ArgumentNullException("right");
8299 if (leftDurationSelector == null)
8300 throw new ArgumentNullException("leftDurationSelector");
8301 if (rightDurationSelector == null)
8302 throw new ArgumentNullException("rightDurationSelector");
8303 if (resultSelector == null)
8304 throw new ArgumentNullException("resultSelector");
8305
8306 return left.Provider.CreateQuery<TResult>(
8307 Expression.Call(
8308 null,
8309 #if CRIPPLED_REFLECTION
8310 InfoOf(() => Qbservable.Join<TLeft, TRight, TLeftDuration, TRightDuration, TResult>(default(IQbservable<TLeft>), default(IObservable<TRight>), default(Expression<Func<TLeft, IObservable<TLeftDuration>>>), default(Expression<Func<TRight, IObservable<TRightDuration>>>), default(Expression<Func<TLeft, TRight, TResult>>))),
8311 #else
8312 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TLeft), typeof(TRight), typeof(TLeftDuration), typeof(TRightDuration), typeof(TResult)),
8313 #endif
8314 left.Expression,
8315 GetSourceExpression(right),
8316 leftDurationSelector,
8317 rightDurationSelector,
8318 resultSelector
8319 )
8320 );
8321 }
8322
8323 /// <summary>
8324 /// Returns the last element of an observable sequence.
8325 /// </summary>
8326 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8327 /// <param name="source">Source observable sequence.</param>
8328 /// <returns>Sequence containing the last element in the observable sequence.</returns>
8329 /// <exception cref="T:System.ArgumentNullException">
8330 /// <paramref name="source" /> is null.</exception>
8331 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence is empty.</exception>
8332 public static IQbservable<TSource> LastAsync<TSource>(this IQbservable<TSource> source)
8333 {
8334 if (source == null)
8335 throw new ArgumentNullException("source");
8336
8337 return source.Provider.CreateQuery<TSource>(
8338 Expression.Call(
8339 null,
8340 #if CRIPPLED_REFLECTION
8341 InfoOf(() => Qbservable.LastAsync<TSource>(default(IQbservable<TSource>))),
8342 #else
8343 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8344 #endif
8345 source.Expression
8346 )
8347 );
8348 }
8349
8350 /// <summary>
8351 /// Returns the last element of an observable sequence that satisfies the condition in the predicate.
8352 /// </summary>
8353 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8354 /// <param name="source">Source observable sequence.</param>
8355 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
8356 /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.</returns>
8357 /// <exception cref="T:System.ArgumentNullException">
8358 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
8359 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
8360 public static IQbservable<TSource> LastAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
8361 {
8362 if (source == null)
8363 throw new ArgumentNullException("source");
8364 if (predicate == null)
8365 throw new ArgumentNullException("predicate");
8366
8367 return source.Provider.CreateQuery<TSource>(
8368 Expression.Call(
8369 null,
8370 #if CRIPPLED_REFLECTION
8371 InfoOf(() => Qbservable.LastAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
8372 #else
8373 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8374 #endif
8375 source.Expression,
8376 predicate
8377 )
8378 );
8379 }
8380
8381 /// <summary>
8382 /// Returns the last element of an observable sequence, or a default value if no such element exists.
8383 /// </summary>
8384 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8385 /// <param name="source">Source observable sequence.</param>
8386 /// <returns>Sequence containing the last element in the observable sequence, or a default value if no such element exists.</returns>
8387 /// <exception cref="T:System.ArgumentNullException">
8388 /// <paramref name="source" /> is null.</exception>
8389 public static IQbservable<TSource> LastOrDefaultAsync<TSource>(this IQbservable<TSource> source)
8390 {
8391 if (source == null)
8392 throw new ArgumentNullException("source");
8393
8394 return source.Provider.CreateQuery<TSource>(
8395 Expression.Call(
8396 null,
8397 #if CRIPPLED_REFLECTION
8398 InfoOf(() => Qbservable.LastOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
8399 #else
8400 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8401 #endif
8402 source.Expression
8403 )
8404 );
8405 }
8406
8407 /// <summary>
8408 /// Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
8409 /// </summary>
8410 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8411 /// <param name="source">Source observable sequence.</param>
8412 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
8413 /// <returns>Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
8414 /// <exception cref="T:System.ArgumentNullException">
8415 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
8416 public static IQbservable<TSource> LastOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
8417 {
8418 if (source == null)
8419 throw new ArgumentNullException("source");
8420 if (predicate == null)
8421 throw new ArgumentNullException("predicate");
8422
8423 return source.Provider.CreateQuery<TSource>(
8424 Expression.Call(
8425 null,
8426 #if CRIPPLED_REFLECTION
8427 InfoOf(() => Qbservable.LastOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
8428 #else
8429 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8430 #endif
8431 source.Expression,
8432 predicate
8433 )
8434 );
8435 }
8436
8437 /// <summary>
8438 /// Returns an enumerable sequence whose enumeration returns the latest observed element in the source observable sequence.
8439 /// Enumerators on the resulting sequence will never produce the same element repeatedly, and will block until the next element becomes available.
8440 /// </summary>
8441 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8442 /// <param name="source">Source observable sequence.</param>
8443 /// <returns>The enumerable sequence that returns the last sampled element upon each iteration and subsequently blocks until the next element in the observable source sequence becomes available.</returns>
8444 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
8445 public static IQueryable<TSource> Latest<TSource>(this IQbservable<TSource> source)
8446 {
8447 if (source == null)
8448 throw new ArgumentNullException("source");
8449
8450 return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
8451 Expression.Call(
8452 null,
8453 #if CRIPPLED_REFLECTION
8454 InfoOf(() => Qbservable.Latest<TSource>(default(IQbservable<TSource>))),
8455 #else
8456 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8457 #endif
8458 source.Expression
8459 )
8460 );
8461 }
8462
8463 /// <summary>
8464 /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents the total number of elements in an observable sequence.
8465 /// </summary>
8466 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8467 /// <param name="source">An observable sequence that contains elements to be counted.</param>
8468 /// <returns>An observable sequence containing a single element with the number of elements in the input sequence.</returns>
8469 /// <exception cref="T:System.ArgumentNullException">
8470 /// <paramref name="source" /> is null.</exception>
8471 /// <exception cref="T:System.OverflowException">(Asynchronous) The number of elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
8472 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8473 public static IQbservable<long> LongCount<TSource>(this IQbservable<TSource> source)
8474 {
8475 if (source == null)
8476 throw new ArgumentNullException("source");
8477
8478 return source.Provider.CreateQuery<long>(
8479 Expression.Call(
8480 null,
8481 #if CRIPPLED_REFLECTION
8482 InfoOf(() => Qbservable.LongCount<TSource>(default(IQbservable<TSource>))),
8483 #else
8484 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8485 #endif
8486 source.Expression
8487 )
8488 );
8489 }
8490
8491 /// <summary>
8492 /// Returns an observable sequence containing an <see cref="T:System.Int64" /> that represents how many elements in the specified observable sequence satisfy a condition.
8493 /// </summary>
8494 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8495 /// <param name="source">An observable sequence that contains elements to be counted.</param>
8496 /// <param name="predicate">A function to test each element for a condition.</param>
8497 /// <returns>An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function.</returns>
8498 /// <exception cref="T:System.ArgumentNullException">
8499 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
8500 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8501 public static IQbservable<long> LongCount<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
8502 {
8503 if (source == null)
8504 throw new ArgumentNullException("source");
8505 if (predicate == null)
8506 throw new ArgumentNullException("predicate");
8507
8508 return source.Provider.CreateQuery<long>(
8509 Expression.Call(
8510 null,
8511 #if CRIPPLED_REFLECTION
8512 InfoOf(() => Qbservable.LongCount<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
8513 #else
8514 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8515 #endif
8516 source.Expression,
8517 predicate
8518 )
8519 );
8520 }
8521
8522 /// <summary>
8523 /// Materializes the implicit notifications of an observable sequence as explicit notification values.
8524 /// </summary>
8525 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8526 /// <param name="source">An observable sequence to get notification values for.</param>
8527 /// <returns>An observable sequence containing the materialized notification values from the source sequence.</returns>
8528 /// <exception cref="T:System.ArgumentNullException">
8529 /// <paramref name="source" /> is null.</exception>
8530 public static IQbservable<Notification<TSource>> Materialize<TSource>(this IQbservable<TSource> source)
8531 {
8532 if (source == null)
8533 throw new ArgumentNullException("source");
8534
8535 return source.Provider.CreateQuery<Notification<TSource>>(
8536 Expression.Call(
8537 null,
8538 #if CRIPPLED_REFLECTION
8539 InfoOf(() => Qbservable.Materialize<TSource>(default(IQbservable<TSource>))),
8540 #else
8541 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8542 #endif
8543 source.Expression
8544 )
8545 );
8546 }
8547
8548 /// <summary>
8549 /// Returns the maximum value in an observable sequence of <see cref="T:System.Decimal" /> values.
8550 /// </summary>
8551 /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
8552 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8553 /// <exception cref="T:System.ArgumentNullException">
8554 /// <paramref name="source" /> is null.</exception>
8555 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8556 public static IQbservable<decimal> Max(this IQbservable<decimal> source)
8557 {
8558 if (source == null)
8559 throw new ArgumentNullException("source");
8560
8561 return source.Provider.CreateQuery<decimal>(
8562 Expression.Call(
8563 null,
8564 #if CRIPPLED_REFLECTION
8565 InfoOf(() => Qbservable.Max(default(IQbservable<decimal>))),
8566 #else
8567 (MethodInfo)MethodInfo.GetCurrentMethod(),
8568 #endif
8569 source.Expression
8570 )
8571 );
8572 }
8573
8574 /// <summary>
8575 /// Returns the maximum value in an observable sequence of <see cref="T:System.Double" /> values.
8576 /// </summary>
8577 /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.</param>
8578 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8579 /// <exception cref="T:System.ArgumentNullException">
8580 /// <paramref name="source" /> is null.</exception>
8581 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8582 public static IQbservable<double> Max(this IQbservable<double> source)
8583 {
8584 if (source == null)
8585 throw new ArgumentNullException("source");
8586
8587 return source.Provider.CreateQuery<double>(
8588 Expression.Call(
8589 null,
8590 #if CRIPPLED_REFLECTION
8591 InfoOf(() => Qbservable.Max(default(IQbservable<double>))),
8592 #else
8593 (MethodInfo)MethodInfo.GetCurrentMethod(),
8594 #endif
8595 source.Expression
8596 )
8597 );
8598 }
8599
8600 /// <summary>
8601 /// Returns the maximum value in an observable sequence of <see cref="T:System.Int32" /> values.
8602 /// </summary>
8603 /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
8604 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8605 /// <exception cref="T:System.ArgumentNullException">
8606 /// <paramref name="source" /> is null.</exception>
8607 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8608 public static IQbservable<int> Max(this IQbservable<int> source)
8609 {
8610 if (source == null)
8611 throw new ArgumentNullException("source");
8612
8613 return source.Provider.CreateQuery<int>(
8614 Expression.Call(
8615 null,
8616 #if CRIPPLED_REFLECTION
8617 InfoOf(() => Qbservable.Max(default(IQbservable<int>))),
8618 #else
8619 (MethodInfo)MethodInfo.GetCurrentMethod(),
8620 #endif
8621 source.Expression
8622 )
8623 );
8624 }
8625
8626 /// <summary>
8627 /// Returns the maximum value in an observable sequence of <see cref="T:System.Int64" /> values.
8628 /// </summary>
8629 /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
8630 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8631 /// <exception cref="T:System.ArgumentNullException">
8632 /// <paramref name="source" /> is null.</exception>
8633 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8634 public static IQbservable<long> Max(this IQbservable<long> source)
8635 {
8636 if (source == null)
8637 throw new ArgumentNullException("source");
8638
8639 return source.Provider.CreateQuery<long>(
8640 Expression.Call(
8641 null,
8642 #if CRIPPLED_REFLECTION
8643 InfoOf(() => Qbservable.Max(default(IQbservable<long>))),
8644 #else
8645 (MethodInfo)MethodInfo.GetCurrentMethod(),
8646 #endif
8647 source.Expression
8648 )
8649 );
8650 }
8651
8652 /// <summary>
8653 /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
8654 /// </summary>
8655 /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
8656 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8657 /// <exception cref="T:System.ArgumentNullException">
8658 /// <paramref name="source" /> is null.</exception>
8659 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8660 public static IQbservable<decimal?> Max(this IQbservable<decimal?> source)
8661 {
8662 if (source == null)
8663 throw new ArgumentNullException("source");
8664
8665 return source.Provider.CreateQuery<decimal?>(
8666 Expression.Call(
8667 null,
8668 #if CRIPPLED_REFLECTION
8669 InfoOf(() => Qbservable.Max(default(IQbservable<decimal?>))),
8670 #else
8671 (MethodInfo)MethodInfo.GetCurrentMethod(),
8672 #endif
8673 source.Expression
8674 )
8675 );
8676 }
8677
8678 /// <summary>
8679 /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
8680 /// </summary>
8681 /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.</param>
8682 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8683 /// <exception cref="T:System.ArgumentNullException">
8684 /// <paramref name="source" /> is null.</exception>
8685 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8686 public static IQbservable<double?> Max(this IQbservable<double?> source)
8687 {
8688 if (source == null)
8689 throw new ArgumentNullException("source");
8690
8691 return source.Provider.CreateQuery<double?>(
8692 Expression.Call(
8693 null,
8694 #if CRIPPLED_REFLECTION
8695 InfoOf(() => Qbservable.Max(default(IQbservable<double?>))),
8696 #else
8697 (MethodInfo)MethodInfo.GetCurrentMethod(),
8698 #endif
8699 source.Expression
8700 )
8701 );
8702 }
8703
8704 /// <summary>
8705 /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
8706 /// </summary>
8707 /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
8708 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8709 /// <exception cref="T:System.ArgumentNullException">
8710 /// <paramref name="source" /> is null.</exception>
8711 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8712 public static IQbservable<int?> Max(this IQbservable<int?> source)
8713 {
8714 if (source == null)
8715 throw new ArgumentNullException("source");
8716
8717 return source.Provider.CreateQuery<int?>(
8718 Expression.Call(
8719 null,
8720 #if CRIPPLED_REFLECTION
8721 InfoOf(() => Qbservable.Max(default(IQbservable<int?>))),
8722 #else
8723 (MethodInfo)MethodInfo.GetCurrentMethod(),
8724 #endif
8725 source.Expression
8726 )
8727 );
8728 }
8729
8730 /// <summary>
8731 /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
8732 /// </summary>
8733 /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
8734 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8735 /// <exception cref="T:System.ArgumentNullException">
8736 /// <paramref name="source" /> is null.</exception>
8737 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8738 public static IQbservable<long?> Max(this IQbservable<long?> source)
8739 {
8740 if (source == null)
8741 throw new ArgumentNullException("source");
8742
8743 return source.Provider.CreateQuery<long?>(
8744 Expression.Call(
8745 null,
8746 #if CRIPPLED_REFLECTION
8747 InfoOf(() => Qbservable.Max(default(IQbservable<long?>))),
8748 #else
8749 (MethodInfo)MethodInfo.GetCurrentMethod(),
8750 #endif
8751 source.Expression
8752 )
8753 );
8754 }
8755
8756 /// <summary>
8757 /// Returns the maximum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
8758 /// </summary>
8759 /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.</param>
8760 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8761 /// <exception cref="T:System.ArgumentNullException">
8762 /// <paramref name="source" /> is null.</exception>
8763 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8764 public static IQbservable<float?> Max(this IQbservable<float?> source)
8765 {
8766 if (source == null)
8767 throw new ArgumentNullException("source");
8768
8769 return source.Provider.CreateQuery<float?>(
8770 Expression.Call(
8771 null,
8772 #if CRIPPLED_REFLECTION
8773 InfoOf(() => Qbservable.Max(default(IQbservable<float?>))),
8774 #else
8775 (MethodInfo)MethodInfo.GetCurrentMethod(),
8776 #endif
8777 source.Expression
8778 )
8779 );
8780 }
8781
8782 /// <summary>
8783 /// Returns the maximum value in an observable sequence of <see cref="T:System.Single" /> values.
8784 /// </summary>
8785 /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.</param>
8786 /// <returns>An observable sequence containing a single element with the maximum value in the source sequence.</returns>
8787 /// <exception cref="T:System.ArgumentNullException">
8788 /// <paramref name="source" /> is null.</exception>
8789 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8790 public static IQbservable<float> Max(this IQbservable<float> source)
8791 {
8792 if (source == null)
8793 throw new ArgumentNullException("source");
8794
8795 return source.Provider.CreateQuery<float>(
8796 Expression.Call(
8797 null,
8798 #if CRIPPLED_REFLECTION
8799 InfoOf(() => Qbservable.Max(default(IQbservable<float>))),
8800 #else
8801 (MethodInfo)MethodInfo.GetCurrentMethod(),
8802 #endif
8803 source.Expression
8804 )
8805 );
8806 }
8807
8808 /// <summary>
8809 /// Returns the maximum element in an observable sequence.
8810 /// </summary>
8811 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8812 /// <param name="source">An observable sequence to determine the maximum element of.</param>
8813 /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
8814 /// <exception cref="T:System.ArgumentNullException">
8815 /// <paramref name="source" /> is null.</exception>
8816 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8817 public static IQbservable<TSource> Max<TSource>(this IQbservable<TSource> source)
8818 {
8819 if (source == null)
8820 throw new ArgumentNullException("source");
8821
8822 return source.Provider.CreateQuery<TSource>(
8823 Expression.Call(
8824 null,
8825 #if CRIPPLED_REFLECTION
8826 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>))),
8827 #else
8828 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8829 #endif
8830 source.Expression
8831 )
8832 );
8833 }
8834
8835 /// <summary>
8836 /// Returns the maximum value in an observable sequence according to the specified comparer.
8837 /// </summary>
8838 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8839 /// <param name="source">An observable sequence to determine the maximum element of.</param>
8840 /// <param name="comparer">Comparer used to compare elements.</param>
8841 /// <returns>An observable sequence containing a single element with the maximum element in the source sequence.</returns>
8842 /// <exception cref="T:System.ArgumentNullException">
8843 /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
8844 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8845 public static IQbservable<TSource> Max<TSource>(this IQbservable<TSource> source, IComparer<TSource> comparer)
8846 {
8847 if (source == null)
8848 throw new ArgumentNullException("source");
8849 if (comparer == null)
8850 throw new ArgumentNullException("comparer");
8851
8852 return source.Provider.CreateQuery<TSource>(
8853 Expression.Call(
8854 null,
8855 #if CRIPPLED_REFLECTION
8856 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(IComparer<TSource>))),
8857 #else
8858 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8859 #endif
8860 source.Expression,
8861 Expression.Constant(comparer, typeof(IComparer<TSource>))
8862 )
8863 );
8864 }
8865
8866 /// <summary>
8867 /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.
8868 /// </summary>
8869 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8870 /// <param name="source">A sequence of values to determine the maximum value of.</param>
8871 /// <param name="selector">A transform function to apply to each element.</param>
8872 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the maximum value in the source sequence.</returns>
8873 /// <exception cref="T:System.ArgumentNullException">
8874 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
8875 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8876 public static IQbservable<double> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
8877 {
8878 if (source == null)
8879 throw new ArgumentNullException("source");
8880 if (selector == null)
8881 throw new ArgumentNullException("selector");
8882
8883 return source.Provider.CreateQuery<double>(
8884 Expression.Call(
8885 null,
8886 #if CRIPPLED_REFLECTION
8887 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
8888 #else
8889 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8890 #endif
8891 source.Expression,
8892 selector
8893 )
8894 );
8895 }
8896
8897 /// <summary>
8898 /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.
8899 /// </summary>
8900 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8901 /// <param name="source">A sequence of values to determine the maximum value of.</param>
8902 /// <param name="selector">A transform function to apply to each element.</param>
8903 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the maximum value in the source sequence.</returns>
8904 /// <exception cref="T:System.ArgumentNullException">
8905 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
8906 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8907 public static IQbservable<float> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
8908 {
8909 if (source == null)
8910 throw new ArgumentNullException("source");
8911 if (selector == null)
8912 throw new ArgumentNullException("selector");
8913
8914 return source.Provider.CreateQuery<float>(
8915 Expression.Call(
8916 null,
8917 #if CRIPPLED_REFLECTION
8918 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
8919 #else
8920 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8921 #endif
8922 source.Expression,
8923 selector
8924 )
8925 );
8926 }
8927
8928 /// <summary>
8929 /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.
8930 /// </summary>
8931 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8932 /// <param name="source">A sequence of values to determine the maximum value of.</param>
8933 /// <param name="selector">A transform function to apply to each element.</param>
8934 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the maximum value in the source sequence.</returns>
8935 /// <exception cref="T:System.ArgumentNullException">
8936 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
8937 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8938 public static IQbservable<decimal> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
8939 {
8940 if (source == null)
8941 throw new ArgumentNullException("source");
8942 if (selector == null)
8943 throw new ArgumentNullException("selector");
8944
8945 return source.Provider.CreateQuery<decimal>(
8946 Expression.Call(
8947 null,
8948 #if CRIPPLED_REFLECTION
8949 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
8950 #else
8951 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8952 #endif
8953 source.Expression,
8954 selector
8955 )
8956 );
8957 }
8958
8959 /// <summary>
8960 /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.
8961 /// </summary>
8962 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8963 /// <param name="source">A sequence of values to determine the maximum value of.</param>
8964 /// <param name="selector">A transform function to apply to each element.</param>
8965 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the maximum value in the source sequence.</returns>
8966 /// <exception cref="T:System.ArgumentNullException">
8967 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
8968 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
8969 public static IQbservable<int> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
8970 {
8971 if (source == null)
8972 throw new ArgumentNullException("source");
8973 if (selector == null)
8974 throw new ArgumentNullException("selector");
8975
8976 return source.Provider.CreateQuery<int>(
8977 Expression.Call(
8978 null,
8979 #if CRIPPLED_REFLECTION
8980 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
8981 #else
8982 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
8983 #endif
8984 source.Expression,
8985 selector
8986 )
8987 );
8988 }
8989
8990 /// <summary>
8991 /// Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.
8992 /// </summary>
8993 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
8994 /// <param name="source">A sequence of values to determine the maximum value of.</param>
8995 /// <param name="selector">A transform function to apply to each element.</param>
8996 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the maximum value in the source sequence.</returns>
8997 /// <exception cref="T:System.ArgumentNullException">
8998 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
8999 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9000 public static IQbservable<long> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
9001 {
9002 if (source == null)
9003 throw new ArgumentNullException("source");
9004 if (selector == null)
9005 throw new ArgumentNullException("selector");
9006
9007 return source.Provider.CreateQuery<long>(
9008 Expression.Call(
9009 null,
9010 #if CRIPPLED_REFLECTION
9011 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
9012 #else
9013 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9014 #endif
9015 source.Expression,
9016 selector
9017 )
9018 );
9019 }
9020
9021 /// <summary>
9022 /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.
9023 /// </summary>
9024 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9025 /// <param name="source">A sequence of values to determine the maximum value of.</param>
9026 /// <param name="selector">A transform function to apply to each element.</param>
9027 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
9028 /// <exception cref="T:System.ArgumentNullException">
9029 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9030 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9031 public static IQbservable<double?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
9032 {
9033 if (source == null)
9034 throw new ArgumentNullException("source");
9035 if (selector == null)
9036 throw new ArgumentNullException("selector");
9037
9038 return source.Provider.CreateQuery<double?>(
9039 Expression.Call(
9040 null,
9041 #if CRIPPLED_REFLECTION
9042 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
9043 #else
9044 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9045 #endif
9046 source.Expression,
9047 selector
9048 )
9049 );
9050 }
9051
9052 /// <summary>
9053 /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.
9054 /// </summary>
9055 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9056 /// <param name="source">A sequence of values to determine the maximum value of.</param>
9057 /// <param name="selector">A transform function to apply to each element.</param>
9058 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
9059 /// <exception cref="T:System.ArgumentNullException">
9060 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9061 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9062 public static IQbservable<float?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
9063 {
9064 if (source == null)
9065 throw new ArgumentNullException("source");
9066 if (selector == null)
9067 throw new ArgumentNullException("selector");
9068
9069 return source.Provider.CreateQuery<float?>(
9070 Expression.Call(
9071 null,
9072 #if CRIPPLED_REFLECTION
9073 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
9074 #else
9075 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9076 #endif
9077 source.Expression,
9078 selector
9079 )
9080 );
9081 }
9082
9083 /// <summary>
9084 /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.
9085 /// </summary>
9086 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9087 /// <param name="source">A sequence of values to determine the maximum value of.</param>
9088 /// <param name="selector">A transform function to apply to each element.</param>
9089 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
9090 /// <exception cref="T:System.ArgumentNullException">
9091 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9092 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9093 public static IQbservable<decimal?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
9094 {
9095 if (source == null)
9096 throw new ArgumentNullException("source");
9097 if (selector == null)
9098 throw new ArgumentNullException("selector");
9099
9100 return source.Provider.CreateQuery<decimal?>(
9101 Expression.Call(
9102 null,
9103 #if CRIPPLED_REFLECTION
9104 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
9105 #else
9106 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9107 #endif
9108 source.Expression,
9109 selector
9110 )
9111 );
9112 }
9113
9114 /// <summary>
9115 /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.
9116 /// </summary>
9117 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9118 /// <param name="source">A sequence of values to determine the maximum value of.</param>
9119 /// <param name="selector">A transform function to apply to each element.</param>
9120 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
9121 /// <exception cref="T:System.ArgumentNullException">
9122 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9123 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9124 public static IQbservable<int?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
9125 {
9126 if (source == null)
9127 throw new ArgumentNullException("source");
9128 if (selector == null)
9129 throw new ArgumentNullException("selector");
9130
9131 return source.Provider.CreateQuery<int?>(
9132 Expression.Call(
9133 null,
9134 #if CRIPPLED_REFLECTION
9135 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
9136 #else
9137 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9138 #endif
9139 source.Expression,
9140 selector
9141 )
9142 );
9143 }
9144
9145 /// <summary>
9146 /// Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.
9147 /// </summary>
9148 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9149 /// <param name="source">A sequence of values to determine the maximum value of.</param>
9150 /// <param name="selector">A transform function to apply to each element.</param>
9151 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the maximum value in the source sequence.</returns>
9152 /// <exception cref="T:System.ArgumentNullException">
9153 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9154 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9155 public static IQbservable<long?> Max<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
9156 {
9157 if (source == null)
9158 throw new ArgumentNullException("source");
9159 if (selector == null)
9160 throw new ArgumentNullException("selector");
9161
9162 return source.Provider.CreateQuery<long?>(
9163 Expression.Call(
9164 null,
9165 #if CRIPPLED_REFLECTION
9166 InfoOf(() => Qbservable.Max<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
9167 #else
9168 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9169 #endif
9170 source.Expression,
9171 selector
9172 )
9173 );
9174 }
9175
9176 /// <summary>
9177 /// Invokes a transform function on each element of a sequence and returns the maximum value.
9178 /// </summary>
9179 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9180 /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
9181 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
9182 /// <param name="selector">A transform function to apply to each element.</param>
9183 /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
9184 /// <exception cref="T:System.ArgumentNullException">
9185 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9186 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9187 public static IQbservable<TResult> Max<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
9188 {
9189 if (source == null)
9190 throw new ArgumentNullException("source");
9191 if (selector == null)
9192 throw new ArgumentNullException("selector");
9193
9194 return source.Provider.CreateQuery<TResult>(
9195 Expression.Call(
9196 null,
9197 #if CRIPPLED_REFLECTION
9198 InfoOf(() => Qbservable.Max<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
9199 #else
9200 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
9201 #endif
9202 source.Expression,
9203 selector
9204 )
9205 );
9206 }
9207
9208 /// <summary>
9209 /// Invokes a transform function on each element of a sequence and returns the maximum value according to the specified comparer.
9210 /// </summary>
9211 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9212 /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the maximum of.</typeparam>
9213 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
9214 /// <param name="selector">A transform function to apply to each element.</param>
9215 /// <param name="comparer">Comparer used to compare elements.</param>
9216 /// <returns>An observable sequence containing a single element with the value that corresponds to the maximum element in the source sequence.</returns>
9217 /// <exception cref="T:System.ArgumentNullException">
9218 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="comparer" /> is null.</exception>
9219 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9220 public static IQbservable<TResult> Max<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector, IComparer<TResult> comparer)
9221 {
9222 if (source == null)
9223 throw new ArgumentNullException("source");
9224 if (selector == null)
9225 throw new ArgumentNullException("selector");
9226 if (comparer == null)
9227 throw new ArgumentNullException("comparer");
9228
9229 return source.Provider.CreateQuery<TResult>(
9230 Expression.Call(
9231 null,
9232 #if CRIPPLED_REFLECTION
9233 InfoOf(() => Qbservable.Max<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>), default(IComparer<TResult>))),
9234 #else
9235 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
9236 #endif
9237 source.Expression,
9238 selector,
9239 Expression.Constant(comparer, typeof(IComparer<TResult>))
9240 )
9241 );
9242 }
9243
9244 /// <summary>
9245 /// Returns the elements in an observable sequence with the maximum key value.
9246 /// </summary>
9247 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9248 /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
9249 /// <param name="source">An observable sequence to get the maximum elements for.</param>
9250 /// <param name="keySelector">Key selector function.</param>
9251 /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
9252 /// <exception cref="T:System.ArgumentNullException">
9253 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
9254 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9255 public static IQbservable<IList<TSource>> MaxBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
9256 {
9257 if (source == null)
9258 throw new ArgumentNullException("source");
9259 if (keySelector == null)
9260 throw new ArgumentNullException("keySelector");
9261
9262 return source.Provider.CreateQuery<IList<TSource>>(
9263 Expression.Call(
9264 null,
9265 #if CRIPPLED_REFLECTION
9266 InfoOf(() => Qbservable.MaxBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
9267 #else
9268 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
9269 #endif
9270 source.Expression,
9271 keySelector
9272 )
9273 );
9274 }
9275
9276 /// <summary>
9277 /// Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
9278 /// </summary>
9279 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9280 /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
9281 /// <param name="source">An observable sequence to get the maximum elements for.</param>
9282 /// <param name="keySelector">Key selector function.</param>
9283 /// <param name="comparer">Comparer used to compare key values.</param>
9284 /// <returns>An observable sequence containing a list of zero or more elements that have a maximum key value.</returns>
9285 /// <exception cref="T:System.ArgumentNullException">
9286 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
9287 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9288 public static IQbservable<IList<TSource>> MaxBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
9289 {
9290 if (source == null)
9291 throw new ArgumentNullException("source");
9292 if (keySelector == null)
9293 throw new ArgumentNullException("keySelector");
9294 if (comparer == null)
9295 throw new ArgumentNullException("comparer");
9296
9297 return source.Provider.CreateQuery<IList<TSource>>(
9298 Expression.Call(
9299 null,
9300 #if CRIPPLED_REFLECTION
9301 InfoOf(() => Qbservable.MaxBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))),
9302 #else
9303 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
9304 #endif
9305 source.Expression,
9306 keySelector,
9307 Expression.Constant(comparer, typeof(IComparer<TKey>))
9308 )
9309 );
9310 }
9311
9312 /// <summary>
9313 /// Merges elements from two observable sequences into a single observable sequence.
9314 /// </summary>
9315 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9316 /// <param name="first">First observable sequence.</param>
9317 /// <param name="second">Second observable sequence.</param>
9318 /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
9319 /// <exception cref="T:System.ArgumentNullException">
9320 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
9321 public static IQbservable<TSource> Merge<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
9322 {
9323 if (first == null)
9324 throw new ArgumentNullException("first");
9325 if (second == null)
9326 throw new ArgumentNullException("second");
9327
9328 return first.Provider.CreateQuery<TSource>(
9329 Expression.Call(
9330 null,
9331 #if CRIPPLED_REFLECTION
9332 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
9333 #else
9334 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9335 #endif
9336 first.Expression,
9337 GetSourceExpression(second)
9338 )
9339 );
9340 }
9341
9342 /// <summary>
9343 /// Merges elements from two observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
9344 /// </summary>
9345 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9346 /// <param name="first">First observable sequence.</param>
9347 /// <param name="second">Second observable sequence.</param>
9348 /// <param name="scheduler">Scheduler used to introduce concurrency for making subscriptions to the given sequences.</param>
9349 /// <returns>The observable sequence that merges the elements of the given sequences.</returns>
9350 /// <exception cref="T:System.ArgumentNullException">
9351 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="scheduler" /> is null.</exception>
9352 public static IQbservable<TSource> Merge<TSource>(this IQbservable<TSource> first, IObservable<TSource> second, IScheduler scheduler)
9353 {
9354 if (first == null)
9355 throw new ArgumentNullException("first");
9356 if (second == null)
9357 throw new ArgumentNullException("second");
9358 if (scheduler == null)
9359 throw new ArgumentNullException("scheduler");
9360
9361 return first.Provider.CreateQuery<TSource>(
9362 Expression.Call(
9363 null,
9364 #if CRIPPLED_REFLECTION
9365 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>), default(IScheduler))),
9366 #else
9367 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9368 #endif
9369 first.Expression,
9370 GetSourceExpression(second),
9371 Expression.Constant(scheduler, typeof(IScheduler))
9372 )
9373 );
9374 }
9375
9376 /// <summary>
9377 /// Merges elements from all of the specified observable sequences into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
9378 /// </summary>
9379 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9380 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9381 /// <param name="sources">Observable sequences.</param>
9382 /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
9383 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9384 /// <exception cref="T:System.ArgumentNullException">
9385 /// <paramref name="scheduler" /> or <paramref name="sources" /> is null.</exception>
9386 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IScheduler scheduler, params IObservable<TSource>[] sources)
9387 {
9388 if (provider == null)
9389 throw new ArgumentNullException("provider");
9390 if (scheduler == null)
9391 throw new ArgumentNullException("scheduler");
9392 if (sources == null)
9393 throw new ArgumentNullException("sources");
9394
9395 return provider.CreateQuery<TSource>(
9396 Expression.Call(
9397 null,
9398 #if CRIPPLED_REFLECTION
9399 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IScheduler), default(IObservable<TSource>[]))),
9400 #else
9401 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9402 #endif
9403 Expression.Constant(provider, typeof(IQbservableProvider)),
9404 Expression.Constant(scheduler, typeof(IScheduler)),
9405 GetSourceExpression(sources)
9406 )
9407 );
9408 }
9409
9410 /// <summary>
9411 /// Merges elements from all inner observable sequences into a single observable sequence.
9412 /// </summary>
9413 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9414 /// <param name="sources">Observable sequence of inner observable sequences.</param>
9415 /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
9416 /// <exception cref="T:System.ArgumentNullException">
9417 /// <paramref name="sources" /> is null.</exception>
9418 public static IQbservable<TSource> Merge<TSource>(this IQbservable<IObservable<TSource>> sources)
9419 {
9420 if (sources == null)
9421 throw new ArgumentNullException("sources");
9422
9423 return sources.Provider.CreateQuery<TSource>(
9424 Expression.Call(
9425 null,
9426 #if CRIPPLED_REFLECTION
9427 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<IObservable<TSource>>))),
9428 #else
9429 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9430 #endif
9431 sources.Expression
9432 )
9433 );
9434 }
9435
9436 #if !NO_TPL
9437 /// <summary>
9438 /// Merges results from all source tasks into a single observable sequence.
9439 /// </summary>
9440 /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
9441 /// <param name="sources">Observable sequence of tasks.</param>
9442 /// <returns>The observable sequence that merges the results of the source tasks.</returns>
9443 /// <exception cref="T:System.ArgumentNullException">
9444 /// <paramref name="sources" /> is null.</exception>
9445 /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a merge operation using <see cref="M:System.Reactive.Linq.Observable.Merge``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
9446 public static IQbservable<TSource> Merge<TSource>(this IQbservable<Task<TSource>> sources)
9447 {
9448 if (sources == null)
9449 throw new ArgumentNullException("sources");
9450
9451 return sources.Provider.CreateQuery<TSource>(
9452 Expression.Call(
9453 null,
9454 #if CRIPPLED_REFLECTION
9455 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<Task<TSource>>))),
9456 #else
9457 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9458 #endif
9459 sources.Expression
9460 )
9461 );
9462 }
9463 #endif
9464
9465 /// <summary>
9466 /// Merges elements from all of the specified observable sequences into a single observable sequence.
9467 /// </summary>
9468 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9469 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9470 /// <param name="sources">Observable sequences.</param>
9471 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9472 /// <exception cref="T:System.ArgumentNullException">
9473 /// <paramref name="sources" /> is null.</exception>
9474 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
9475 {
9476 if (provider == null)
9477 throw new ArgumentNullException("provider");
9478 if (sources == null)
9479 throw new ArgumentNullException("sources");
9480
9481 return provider.CreateQuery<TSource>(
9482 Expression.Call(
9483 null,
9484 #if CRIPPLED_REFLECTION
9485 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
9486 #else
9487 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9488 #endif
9489 Expression.Constant(provider, typeof(IQbservableProvider)),
9490 GetSourceExpression(sources)
9491 )
9492 );
9493 }
9494
9495 /// <summary>
9496 /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.
9497 /// </summary>
9498 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9499 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9500 /// <param name="sources">Enumerable sequence of observable sequences.</param>
9501 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9502 /// <exception cref="T:System.ArgumentNullException">
9503 /// <paramref name="sources" /> is null.</exception>
9504 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
9505 {
9506 if (provider == null)
9507 throw new ArgumentNullException("provider");
9508 if (sources == null)
9509 throw new ArgumentNullException("sources");
9510
9511 return provider.CreateQuery<TSource>(
9512 Expression.Call(
9513 null,
9514 #if CRIPPLED_REFLECTION
9515 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
9516 #else
9517 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9518 #endif
9519 Expression.Constant(provider, typeof(IQbservableProvider)),
9520 GetSourceExpression(sources)
9521 )
9522 );
9523 }
9524
9525 /// <summary>
9526 /// Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
9527 /// </summary>
9528 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9529 /// <param name="sources">Observable sequence of inner observable sequences.</param>
9530 /// <param name="maxConcurrent">Maximum number of inner observable sequences being subscribed to concurrently.</param>
9531 /// <returns>The observable sequence that merges the elements of the inner sequences.</returns>
9532 /// <exception cref="T:System.ArgumentNullException">
9533 /// <paramref name="sources" /> is null.</exception>
9534 /// <exception cref="T:System.ArgumentOutOfRangeException">
9535 /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
9536 public static IQbservable<TSource> Merge<TSource>(this IQbservable<IObservable<TSource>> sources, int maxConcurrent)
9537 {
9538 if (sources == null)
9539 throw new ArgumentNullException("sources");
9540
9541 return sources.Provider.CreateQuery<TSource>(
9542 Expression.Call(
9543 null,
9544 #if CRIPPLED_REFLECTION
9545 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservable<IObservable<TSource>>), default(int))),
9546 #else
9547 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9548 #endif
9549 sources.Expression,
9550 Expression.Constant(maxConcurrent, typeof(int))
9551 )
9552 );
9553 }
9554
9555 /// <summary>
9556 /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.
9557 /// </summary>
9558 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9559 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9560 /// <param name="sources">Enumerable sequence of observable sequences.</param>
9561 /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
9562 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9563 /// <exception cref="T:System.ArgumentNullException">
9564 /// <paramref name="sources" /> is null.</exception>
9565 /// <exception cref="T:System.ArgumentOutOfRangeException">
9566 /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
9567 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, int maxConcurrent)
9568 {
9569 if (provider == null)
9570 throw new ArgumentNullException("provider");
9571 if (sources == null)
9572 throw new ArgumentNullException("sources");
9573
9574 return provider.CreateQuery<TSource>(
9575 Expression.Call(
9576 null,
9577 #if CRIPPLED_REFLECTION
9578 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(int))),
9579 #else
9580 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9581 #endif
9582 Expression.Constant(provider, typeof(IQbservableProvider)),
9583 GetSourceExpression(sources),
9584 Expression.Constant(maxConcurrent, typeof(int))
9585 )
9586 );
9587 }
9588
9589 /// <summary>
9590 /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences, and using the specified scheduler for enumeration of and subscription to the sources.
9591 /// </summary>
9592 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9593 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9594 /// <param name="sources">Enumerable sequence of observable sequences.</param>
9595 /// <param name="maxConcurrent">Maximum number of observable sequences being subscribed to concurrently.</param>
9596 /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
9597 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9598 /// <exception cref="T:System.ArgumentNullException">
9599 /// <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
9600 /// <exception cref="T:System.ArgumentOutOfRangeException">
9601 /// <paramref name="maxConcurrent" /> is less than or equal to zero.</exception>
9602 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, int maxConcurrent, IScheduler scheduler)
9603 {
9604 if (provider == null)
9605 throw new ArgumentNullException("provider");
9606 if (sources == null)
9607 throw new ArgumentNullException("sources");
9608 if (scheduler == null)
9609 throw new ArgumentNullException("scheduler");
9610
9611 return provider.CreateQuery<TSource>(
9612 Expression.Call(
9613 null,
9614 #if CRIPPLED_REFLECTION
9615 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(int), default(IScheduler))),
9616 #else
9617 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9618 #endif
9619 Expression.Constant(provider, typeof(IQbservableProvider)),
9620 GetSourceExpression(sources),
9621 Expression.Constant(maxConcurrent, typeof(int)),
9622 Expression.Constant(scheduler, typeof(IScheduler))
9623 )
9624 );
9625 }
9626
9627 /// <summary>
9628 /// Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence, using the specified scheduler for enumeration of and subscription to the sources.
9629 /// </summary>
9630 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
9631 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
9632 /// <param name="sources">Enumerable sequence of observable sequences.</param>
9633 /// <param name="scheduler">Scheduler to run the enumeration of the sequence of sources on.</param>
9634 /// <returns>The observable sequence that merges the elements of the observable sequences.</returns>
9635 /// <exception cref="T:System.ArgumentNullException">
9636 /// <paramref name="sources" /> or <paramref name="scheduler" /> is null.</exception>
9637 public static IQbservable<TSource> Merge<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, IScheduler scheduler)
9638 {
9639 if (provider == null)
9640 throw new ArgumentNullException("provider");
9641 if (sources == null)
9642 throw new ArgumentNullException("sources");
9643 if (scheduler == null)
9644 throw new ArgumentNullException("scheduler");
9645
9646 return provider.CreateQuery<TSource>(
9647 Expression.Call(
9648 null,
9649 #if CRIPPLED_REFLECTION
9650 InfoOf(() => Qbservable.Merge<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(IScheduler))),
9651 #else
9652 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9653 #endif
9654 Expression.Constant(provider, typeof(IQbservableProvider)),
9655 GetSourceExpression(sources),
9656 Expression.Constant(scheduler, typeof(IScheduler))
9657 )
9658 );
9659 }
9660
9661 /// <summary>
9662 /// Returns the minimum value in an observable sequence of <see cref="T:System.Decimal" /> values.
9663 /// </summary>
9664 /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
9665 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9666 /// <exception cref="T:System.ArgumentNullException">
9667 /// <paramref name="source" /> is null.</exception>
9668 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9669 public static IQbservable<decimal> Min(this IQbservable<decimal> source)
9670 {
9671 if (source == null)
9672 throw new ArgumentNullException("source");
9673
9674 return source.Provider.CreateQuery<decimal>(
9675 Expression.Call(
9676 null,
9677 #if CRIPPLED_REFLECTION
9678 InfoOf(() => Qbservable.Min(default(IQbservable<decimal>))),
9679 #else
9680 (MethodInfo)MethodInfo.GetCurrentMethod(),
9681 #endif
9682 source.Expression
9683 )
9684 );
9685 }
9686
9687 /// <summary>
9688 /// Returns the minimum value in an observable sequence of <see cref="T:System.Double" /> values.
9689 /// </summary>
9690 /// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.</param>
9691 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9692 /// <exception cref="T:System.ArgumentNullException">
9693 /// <paramref name="source" /> is null.</exception>
9694 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9695 public static IQbservable<double> Min(this IQbservable<double> source)
9696 {
9697 if (source == null)
9698 throw new ArgumentNullException("source");
9699
9700 return source.Provider.CreateQuery<double>(
9701 Expression.Call(
9702 null,
9703 #if CRIPPLED_REFLECTION
9704 InfoOf(() => Qbservable.Min(default(IQbservable<double>))),
9705 #else
9706 (MethodInfo)MethodInfo.GetCurrentMethod(),
9707 #endif
9708 source.Expression
9709 )
9710 );
9711 }
9712
9713 /// <summary>
9714 /// Returns the minimum value in an observable sequence of <see cref="T:System.Int32" /> values.
9715 /// </summary>
9716 /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
9717 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9718 /// <exception cref="T:System.ArgumentNullException">
9719 /// <paramref name="source" /> is null.</exception>
9720 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9721 public static IQbservable<int> Min(this IQbservable<int> source)
9722 {
9723 if (source == null)
9724 throw new ArgumentNullException("source");
9725
9726 return source.Provider.CreateQuery<int>(
9727 Expression.Call(
9728 null,
9729 #if CRIPPLED_REFLECTION
9730 InfoOf(() => Qbservable.Min(default(IQbservable<int>))),
9731 #else
9732 (MethodInfo)MethodInfo.GetCurrentMethod(),
9733 #endif
9734 source.Expression
9735 )
9736 );
9737 }
9738
9739 /// <summary>
9740 /// Returns the minimum value in an observable sequence of <see cref="T:System.Int64" /> values.
9741 /// </summary>
9742 /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
9743 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9744 /// <exception cref="T:System.ArgumentNullException">
9745 /// <paramref name="source" /> is null.</exception>
9746 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9747 public static IQbservable<long> Min(this IQbservable<long> source)
9748 {
9749 if (source == null)
9750 throw new ArgumentNullException("source");
9751
9752 return source.Provider.CreateQuery<long>(
9753 Expression.Call(
9754 null,
9755 #if CRIPPLED_REFLECTION
9756 InfoOf(() => Qbservable.Min(default(IQbservable<long>))),
9757 #else
9758 (MethodInfo)MethodInfo.GetCurrentMethod(),
9759 #endif
9760 source.Expression
9761 )
9762 );
9763 }
9764
9765 /// <summary>
9766 /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Decimal" /> values.
9767 /// </summary>
9768 /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
9769 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9770 /// <exception cref="T:System.ArgumentNullException">
9771 /// <paramref name="source" /> is null.</exception>
9772 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9773 public static IQbservable<decimal?> Min(this IQbservable<decimal?> source)
9774 {
9775 if (source == null)
9776 throw new ArgumentNullException("source");
9777
9778 return source.Provider.CreateQuery<decimal?>(
9779 Expression.Call(
9780 null,
9781 #if CRIPPLED_REFLECTION
9782 InfoOf(() => Qbservable.Min(default(IQbservable<decimal?>))),
9783 #else
9784 (MethodInfo)MethodInfo.GetCurrentMethod(),
9785 #endif
9786 source.Expression
9787 )
9788 );
9789 }
9790
9791 /// <summary>
9792 /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Double" /> values.
9793 /// </summary>
9794 /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.</param>
9795 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9796 /// <exception cref="T:System.ArgumentNullException">
9797 /// <paramref name="source" /> is null.</exception>
9798 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9799 public static IQbservable<double?> Min(this IQbservable<double?> source)
9800 {
9801 if (source == null)
9802 throw new ArgumentNullException("source");
9803
9804 return source.Provider.CreateQuery<double?>(
9805 Expression.Call(
9806 null,
9807 #if CRIPPLED_REFLECTION
9808 InfoOf(() => Qbservable.Min(default(IQbservable<double?>))),
9809 #else
9810 (MethodInfo)MethodInfo.GetCurrentMethod(),
9811 #endif
9812 source.Expression
9813 )
9814 );
9815 }
9816
9817 /// <summary>
9818 /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int32" /> values.
9819 /// </summary>
9820 /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
9821 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9822 /// <exception cref="T:System.ArgumentNullException">
9823 /// <paramref name="source" /> is null.</exception>
9824 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9825 public static IQbservable<int?> Min(this IQbservable<int?> source)
9826 {
9827 if (source == null)
9828 throw new ArgumentNullException("source");
9829
9830 return source.Provider.CreateQuery<int?>(
9831 Expression.Call(
9832 null,
9833 #if CRIPPLED_REFLECTION
9834 InfoOf(() => Qbservable.Min(default(IQbservable<int?>))),
9835 #else
9836 (MethodInfo)MethodInfo.GetCurrentMethod(),
9837 #endif
9838 source.Expression
9839 )
9840 );
9841 }
9842
9843 /// <summary>
9844 /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Int64" /> values.
9845 /// </summary>
9846 /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
9847 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9848 /// <exception cref="T:System.ArgumentNullException">
9849 /// <paramref name="source" /> is null.</exception>
9850 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9851 public static IQbservable<long?> Min(this IQbservable<long?> source)
9852 {
9853 if (source == null)
9854 throw new ArgumentNullException("source");
9855
9856 return source.Provider.CreateQuery<long?>(
9857 Expression.Call(
9858 null,
9859 #if CRIPPLED_REFLECTION
9860 InfoOf(() => Qbservable.Min(default(IQbservable<long?>))),
9861 #else
9862 (MethodInfo)MethodInfo.GetCurrentMethod(),
9863 #endif
9864 source.Expression
9865 )
9866 );
9867 }
9868
9869 /// <summary>
9870 /// Returns the minimum value in an observable sequence of nullable <see cref="T:System.Single" /> values.
9871 /// </summary>
9872 /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.</param>
9873 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9874 /// <exception cref="T:System.ArgumentNullException">
9875 /// <paramref name="source" /> is null.</exception>
9876 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9877 public static IQbservable<float?> Min(this IQbservable<float?> source)
9878 {
9879 if (source == null)
9880 throw new ArgumentNullException("source");
9881
9882 return source.Provider.CreateQuery<float?>(
9883 Expression.Call(
9884 null,
9885 #if CRIPPLED_REFLECTION
9886 InfoOf(() => Qbservable.Min(default(IQbservable<float?>))),
9887 #else
9888 (MethodInfo)MethodInfo.GetCurrentMethod(),
9889 #endif
9890 source.Expression
9891 )
9892 );
9893 }
9894
9895 /// <summary>
9896 /// Returns the minimum value in an observable sequence of <see cref="T:System.Single" /> values.
9897 /// </summary>
9898 /// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.</param>
9899 /// <returns>An observable sequence containing a single element with the minimum value in the source sequence.</returns>
9900 /// <exception cref="T:System.ArgumentNullException">
9901 /// <paramref name="source" /> is null.</exception>
9902 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9903 public static IQbservable<float> Min(this IQbservable<float> source)
9904 {
9905 if (source == null)
9906 throw new ArgumentNullException("source");
9907
9908 return source.Provider.CreateQuery<float>(
9909 Expression.Call(
9910 null,
9911 #if CRIPPLED_REFLECTION
9912 InfoOf(() => Qbservable.Min(default(IQbservable<float>))),
9913 #else
9914 (MethodInfo)MethodInfo.GetCurrentMethod(),
9915 #endif
9916 source.Expression
9917 )
9918 );
9919 }
9920
9921 /// <summary>
9922 /// Returns the minimum element in an observable sequence.
9923 /// </summary>
9924 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9925 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
9926 /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
9927 /// <exception cref="T:System.ArgumentNullException">
9928 /// <paramref name="source" /> is null.</exception>
9929 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9930 public static IQbservable<TSource> Min<TSource>(this IQbservable<TSource> source)
9931 {
9932 if (source == null)
9933 throw new ArgumentNullException("source");
9934
9935 return source.Provider.CreateQuery<TSource>(
9936 Expression.Call(
9937 null,
9938 #if CRIPPLED_REFLECTION
9939 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>))),
9940 #else
9941 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9942 #endif
9943 source.Expression
9944 )
9945 );
9946 }
9947
9948 /// <summary>
9949 /// Returns the minimum element in an observable sequence according to the specified comparer.
9950 /// </summary>
9951 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9952 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
9953 /// <param name="comparer">Comparer used to compare elements.</param>
9954 /// <returns>An observable sequence containing a single element with the minimum element in the source sequence.</returns>
9955 /// <exception cref="T:System.ArgumentNullException">
9956 /// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
9957 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9958 public static IQbservable<TSource> Min<TSource>(this IQbservable<TSource> source, IComparer<TSource> comparer)
9959 {
9960 if (source == null)
9961 throw new ArgumentNullException("source");
9962 if (comparer == null)
9963 throw new ArgumentNullException("comparer");
9964
9965 return source.Provider.CreateQuery<TSource>(
9966 Expression.Call(
9967 null,
9968 #if CRIPPLED_REFLECTION
9969 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(IComparer<TSource>))),
9970 #else
9971 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
9972 #endif
9973 source.Expression,
9974 Expression.Constant(comparer, typeof(IComparer<TSource>))
9975 )
9976 );
9977 }
9978
9979 /// <summary>
9980 /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.
9981 /// </summary>
9982 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
9983 /// <param name="source">A sequence of values to determine the minimum value of.</param>
9984 /// <param name="selector">A transform function to apply to each element.</param>
9985 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Double" /> that corresponds to the minimum value in the source sequence.</returns>
9986 /// <exception cref="T:System.ArgumentNullException">
9987 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
9988 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
9989 public static IQbservable<double> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
9990 {
9991 if (source == null)
9992 throw new ArgumentNullException("source");
9993 if (selector == null)
9994 throw new ArgumentNullException("selector");
9995
9996 return source.Provider.CreateQuery<double>(
9997 Expression.Call(
9998 null,
9999 #if CRIPPLED_REFLECTION
10000 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
10001 #else
10002 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10003 #endif
10004 source.Expression,
10005 selector
10006 )
10007 );
10008 }
10009
10010 /// <summary>
10011 /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.
10012 /// </summary>
10013 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10014 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10015 /// <param name="selector">A transform function to apply to each element.</param>
10016 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Single" /> that corresponds to the minimum value in the source sequence.</returns>
10017 /// <exception cref="T:System.ArgumentNullException">
10018 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10019 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10020 public static IQbservable<float> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
10021 {
10022 if (source == null)
10023 throw new ArgumentNullException("source");
10024 if (selector == null)
10025 throw new ArgumentNullException("selector");
10026
10027 return source.Provider.CreateQuery<float>(
10028 Expression.Call(
10029 null,
10030 #if CRIPPLED_REFLECTION
10031 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
10032 #else
10033 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10034 #endif
10035 source.Expression,
10036 selector
10037 )
10038 );
10039 }
10040
10041 /// <summary>
10042 /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.
10043 /// </summary>
10044 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10045 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10046 /// <param name="selector">A transform function to apply to each element.</param>
10047 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Decimal" /> that corresponds to the minimum value in the source sequence.</returns>
10048 /// <exception cref="T:System.ArgumentNullException">
10049 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10050 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10051 public static IQbservable<decimal> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
10052 {
10053 if (source == null)
10054 throw new ArgumentNullException("source");
10055 if (selector == null)
10056 throw new ArgumentNullException("selector");
10057
10058 return source.Provider.CreateQuery<decimal>(
10059 Expression.Call(
10060 null,
10061 #if CRIPPLED_REFLECTION
10062 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
10063 #else
10064 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10065 #endif
10066 source.Expression,
10067 selector
10068 )
10069 );
10070 }
10071
10072 /// <summary>
10073 /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.
10074 /// </summary>
10075 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10076 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10077 /// <param name="selector">A transform function to apply to each element.</param>
10078 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int32" /> that corresponds to the minimum value in the source sequence.</returns>
10079 /// <exception cref="T:System.ArgumentNullException">
10080 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10081 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10082 public static IQbservable<int> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
10083 {
10084 if (source == null)
10085 throw new ArgumentNullException("source");
10086 if (selector == null)
10087 throw new ArgumentNullException("selector");
10088
10089 return source.Provider.CreateQuery<int>(
10090 Expression.Call(
10091 null,
10092 #if CRIPPLED_REFLECTION
10093 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
10094 #else
10095 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10096 #endif
10097 source.Expression,
10098 selector
10099 )
10100 );
10101 }
10102
10103 /// <summary>
10104 /// Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.
10105 /// </summary>
10106 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10107 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10108 /// <param name="selector">A transform function to apply to each element.</param>
10109 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Int64" /> that corresponds to the minimum value in the source sequence.</returns>
10110 /// <exception cref="T:System.ArgumentNullException">
10111 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10112 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10113 public static IQbservable<long> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
10114 {
10115 if (source == null)
10116 throw new ArgumentNullException("source");
10117 if (selector == null)
10118 throw new ArgumentNullException("selector");
10119
10120 return source.Provider.CreateQuery<long>(
10121 Expression.Call(
10122 null,
10123 #if CRIPPLED_REFLECTION
10124 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
10125 #else
10126 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10127 #endif
10128 source.Expression,
10129 selector
10130 )
10131 );
10132 }
10133
10134 /// <summary>
10135 /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.
10136 /// </summary>
10137 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10138 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10139 /// <param name="selector">A transform function to apply to each element.</param>
10140 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Double&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
10141 /// <exception cref="T:System.ArgumentNullException">
10142 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10143 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10144 public static IQbservable<double?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
10145 {
10146 if (source == null)
10147 throw new ArgumentNullException("source");
10148 if (selector == null)
10149 throw new ArgumentNullException("selector");
10150
10151 return source.Provider.CreateQuery<double?>(
10152 Expression.Call(
10153 null,
10154 #if CRIPPLED_REFLECTION
10155 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
10156 #else
10157 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10158 #endif
10159 source.Expression,
10160 selector
10161 )
10162 );
10163 }
10164
10165 /// <summary>
10166 /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.
10167 /// </summary>
10168 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10169 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10170 /// <param name="selector">A transform function to apply to each element.</param>
10171 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Single&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
10172 /// <exception cref="T:System.ArgumentNullException">
10173 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10174 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10175 public static IQbservable<float?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
10176 {
10177 if (source == null)
10178 throw new ArgumentNullException("source");
10179 if (selector == null)
10180 throw new ArgumentNullException("selector");
10181
10182 return source.Provider.CreateQuery<float?>(
10183 Expression.Call(
10184 null,
10185 #if CRIPPLED_REFLECTION
10186 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
10187 #else
10188 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10189 #endif
10190 source.Expression,
10191 selector
10192 )
10193 );
10194 }
10195
10196 /// <summary>
10197 /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.
10198 /// </summary>
10199 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10200 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10201 /// <param name="selector">A transform function to apply to each element.</param>
10202 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Decimal&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
10203 /// <exception cref="T:System.ArgumentNullException">
10204 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10205 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10206 public static IQbservable<decimal?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
10207 {
10208 if (source == null)
10209 throw new ArgumentNullException("source");
10210 if (selector == null)
10211 throw new ArgumentNullException("selector");
10212
10213 return source.Provider.CreateQuery<decimal?>(
10214 Expression.Call(
10215 null,
10216 #if CRIPPLED_REFLECTION
10217 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
10218 #else
10219 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10220 #endif
10221 source.Expression,
10222 selector
10223 )
10224 );
10225 }
10226
10227 /// <summary>
10228 /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.
10229 /// </summary>
10230 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10231 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10232 /// <param name="selector">A transform function to apply to each element.</param>
10233 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int32&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
10234 /// <exception cref="T:System.ArgumentNullException">
10235 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10236 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10237 public static IQbservable<int?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
10238 {
10239 if (source == null)
10240 throw new ArgumentNullException("source");
10241 if (selector == null)
10242 throw new ArgumentNullException("selector");
10243
10244 return source.Provider.CreateQuery<int?>(
10245 Expression.Call(
10246 null,
10247 #if CRIPPLED_REFLECTION
10248 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
10249 #else
10250 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10251 #endif
10252 source.Expression,
10253 selector
10254 )
10255 );
10256 }
10257
10258 /// <summary>
10259 /// Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.
10260 /// </summary>
10261 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10262 /// <param name="source">A sequence of values to determine the minimum value of.</param>
10263 /// <param name="selector">A transform function to apply to each element.</param>
10264 /// <returns>An observable sequence containing a single element with the value of type <see cref="T:System.Nullable&lt;System.Int64&gt;" /> that corresponds to the minimum value in the source sequence.</returns>
10265 /// <exception cref="T:System.ArgumentNullException">
10266 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10267 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10268 public static IQbservable<long?> Min<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
10269 {
10270 if (source == null)
10271 throw new ArgumentNullException("source");
10272 if (selector == null)
10273 throw new ArgumentNullException("selector");
10274
10275 return source.Provider.CreateQuery<long?>(
10276 Expression.Call(
10277 null,
10278 #if CRIPPLED_REFLECTION
10279 InfoOf(() => Qbservable.Min<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
10280 #else
10281 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10282 #endif
10283 source.Expression,
10284 selector
10285 )
10286 );
10287 }
10288
10289 /// <summary>
10290 /// Invokes a transform function on each element of a sequence and returns the minimum value.
10291 /// </summary>
10292 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10293 /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
10294 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
10295 /// <param name="selector">A transform function to apply to each element.</param>
10296 /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
10297 /// <exception cref="T:System.ArgumentNullException">
10298 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10299 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10300 public static IQbservable<TResult> Min<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
10301 {
10302 if (source == null)
10303 throw new ArgumentNullException("source");
10304 if (selector == null)
10305 throw new ArgumentNullException("selector");
10306
10307 return source.Provider.CreateQuery<TResult>(
10308 Expression.Call(
10309 null,
10310 #if CRIPPLED_REFLECTION
10311 InfoOf(() => Qbservable.Min<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
10312 #else
10313 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
10314 #endif
10315 source.Expression,
10316 selector
10317 )
10318 );
10319 }
10320
10321 /// <summary>
10322 /// Invokes a transform function on each element of a sequence and returns the minimum value according to the specified comparer.
10323 /// </summary>
10324 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10325 /// <typeparam name="TResult">The type of the objects derived from the elements in the source sequence to determine the minimum of.</typeparam>
10326 /// <param name="source">An observable sequence to determine the mimimum element of.</param>
10327 /// <param name="selector">A transform function to apply to each element.</param>
10328 /// <param name="comparer">Comparer used to compare elements.</param>
10329 /// <returns>An observable sequence containing a single element with the value that corresponds to the minimum element in the source sequence.</returns>
10330 /// <exception cref="T:System.ArgumentNullException">
10331 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="comparer" /> is null.</exception>
10332 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10333 public static IQbservable<TResult> Min<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector, IComparer<TResult> comparer)
10334 {
10335 if (source == null)
10336 throw new ArgumentNullException("source");
10337 if (selector == null)
10338 throw new ArgumentNullException("selector");
10339 if (comparer == null)
10340 throw new ArgumentNullException("comparer");
10341
10342 return source.Provider.CreateQuery<TResult>(
10343 Expression.Call(
10344 null,
10345 #if CRIPPLED_REFLECTION
10346 InfoOf(() => Qbservable.Min<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>), default(IComparer<TResult>))),
10347 #else
10348 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
10349 #endif
10350 source.Expression,
10351 selector,
10352 Expression.Constant(comparer, typeof(IComparer<TResult>))
10353 )
10354 );
10355 }
10356
10357 /// <summary>
10358 /// Returns the elements in an observable sequence with the minimum key value.
10359 /// </summary>
10360 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10361 /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
10362 /// <param name="source">An observable sequence to get the minimum elements for.</param>
10363 /// <param name="keySelector">Key selector function.</param>
10364 /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
10365 /// <exception cref="T:System.ArgumentNullException">
10366 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
10367 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10368 public static IQbservable<IList<TSource>> MinBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
10369 {
10370 if (source == null)
10371 throw new ArgumentNullException("source");
10372 if (keySelector == null)
10373 throw new ArgumentNullException("keySelector");
10374
10375 return source.Provider.CreateQuery<IList<TSource>>(
10376 Expression.Call(
10377 null,
10378 #if CRIPPLED_REFLECTION
10379 InfoOf(() => Qbservable.MinBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
10380 #else
10381 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
10382 #endif
10383 source.Expression,
10384 keySelector
10385 )
10386 );
10387 }
10388
10389 /// <summary>
10390 /// Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
10391 /// </summary>
10392 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10393 /// <typeparam name="TKey">The type of the key computed for each element in the source sequence.</typeparam>
10394 /// <param name="source">An observable sequence to get the minimum elements for.</param>
10395 /// <param name="keySelector">Key selector function.</param>
10396 /// <param name="comparer">Comparer used to compare key values.</param>
10397 /// <returns>An observable sequence containing a list of zero or more elements that have a minimum key value.</returns>
10398 /// <exception cref="T:System.ArgumentNullException">
10399 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
10400 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
10401 public static IQbservable<IList<TSource>> MinBy<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
10402 {
10403 if (source == null)
10404 throw new ArgumentNullException("source");
10405 if (keySelector == null)
10406 throw new ArgumentNullException("keySelector");
10407 if (comparer == null)
10408 throw new ArgumentNullException("comparer");
10409
10410 return source.Provider.CreateQuery<IList<TSource>>(
10411 Expression.Call(
10412 null,
10413 #if CRIPPLED_REFLECTION
10414 InfoOf(() => Qbservable.MinBy<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))),
10415 #else
10416 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
10417 #endif
10418 source.Expression,
10419 keySelector,
10420 Expression.Constant(comparer, typeof(IComparer<TKey>))
10421 )
10422 );
10423 }
10424
10425 /// <summary>
10426 /// Returns an enumerable sequence whose enumeration returns the most recently observed element in the source observable sequence, using the specified initial value in case no element has been sampled yet.
10427 /// Enumerators on the resulting sequence never block and can produce the same element repeatedly.
10428 /// </summary>
10429 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10430 /// <param name="source">Source observable sequence.</param>
10431 /// <param name="initialValue">Initial value that will be yielded by the enumerable sequence if no element has been sampled yet.</param>
10432 /// <returns>The enumerable sequence that returns the last sampled element upon each iteration.</returns>
10433 /// <exception cref="T:System.ArgumentNullException">
10434 /// <paramref name="source" /> is null.</exception>
10435 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
10436 public static IQueryable<TSource> MostRecent<TSource>(this IQbservable<TSource> source, TSource initialValue)
10437 {
10438 if (source == null)
10439 throw new ArgumentNullException("source");
10440
10441 return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
10442 Expression.Call(
10443 null,
10444 #if CRIPPLED_REFLECTION
10445 InfoOf(() => Qbservable.MostRecent<TSource>(default(IQbservable<TSource>), default(TSource))),
10446 #else
10447 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10448 #endif
10449 source.Expression,
10450 Expression.Constant(initialValue, typeof(TSource))
10451 )
10452 );
10453 }
10454
10455 /// <summary>
10456 /// Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
10457 /// subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
10458 /// invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
10459 /// </summary>
10460 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10461 /// <typeparam name="TIntermediate">The type of the elements produced by the intermediate subject.</typeparam>
10462 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
10463 /// <param name="source">Source sequence which will be multicasted in the specified selector function.</param>
10464 /// <param name="subjectSelector">Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.</param>
10465 /// <param name="selector">Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.</param>
10466 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
10467 /// <exception cref="T:System.ArgumentNullException">
10468 /// <paramref name="source" /> or <paramref name="subjectSelector" /> or <paramref name="selector" /> is null.</exception>
10469 public static IQbservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IQbservable<TSource> source, Expression<Func<ISubject<TSource, TIntermediate>>> subjectSelector, Expression<Func<IObservable<TIntermediate>, IObservable<TResult>>> selector)
10470 {
10471 if (source == null)
10472 throw new ArgumentNullException("source");
10473 if (subjectSelector == null)
10474 throw new ArgumentNullException("subjectSelector");
10475 if (selector == null)
10476 throw new ArgumentNullException("selector");
10477
10478 return source.Provider.CreateQuery<TResult>(
10479 Expression.Call(
10480 null,
10481 #if CRIPPLED_REFLECTION
10482 InfoOf(() => Qbservable.Multicast<TSource, TIntermediate, TResult>(default(IQbservable<TSource>), default(Expression<Func<ISubject<TSource, TIntermediate>>>), default(Expression<Func<IObservable<TIntermediate>, IObservable<TResult>>>))),
10483 #else
10484 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TIntermediate), typeof(TResult)),
10485 #endif
10486 source.Expression,
10487 subjectSelector,
10488 selector
10489 )
10490 );
10491 }
10492
10493 /// <summary>
10494 /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
10495 /// </summary>
10496 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10497 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
10498 /// <returns>An observable sequence whose observers will never get called.</returns>
10499 public static IQbservable<TResult> Never<TResult>(this IQbservableProvider provider)
10500 {
10501 if (provider == null)
10502 throw new ArgumentNullException("provider");
10503
10504 return provider.CreateQuery<TResult>(
10505 Expression.Call(
10506 null,
10507 #if CRIPPLED_REFLECTION
10508 InfoOf(() => Qbservable.Never<TResult>(default(IQbservableProvider))),
10509 #else
10510 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
10511 #endif
10512 Expression.Constant(provider, typeof(IQbservableProvider))
10513 )
10514 );
10515 }
10516
10517 /// <summary>
10518 /// Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
10519 /// </summary>
10520 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10521 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
10522 /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
10523 /// <returns>An observable sequence whose observers will never get called.</returns>
10524 public static IQbservable<TResult> Never<TResult>(this IQbservableProvider provider, TResult witness)
10525 {
10526 if (provider == null)
10527 throw new ArgumentNullException("provider");
10528
10529 return provider.CreateQuery<TResult>(
10530 Expression.Call(
10531 null,
10532 #if CRIPPLED_REFLECTION
10533 InfoOf(() => Qbservable.Never<TResult>(default(IQbservableProvider), default(TResult))),
10534 #else
10535 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
10536 #endif
10537 Expression.Constant(provider, typeof(IQbservableProvider)),
10538 Expression.Constant(witness, typeof(TResult))
10539 )
10540 );
10541 }
10542
10543 /// <summary>
10544 /// Returns an enumerable sequence whose enumeration blocks until the next element in the source observable sequence becomes available.
10545 /// Enumerators on the resulting sequence will block until the next element becomes available.
10546 /// </summary>
10547 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10548 /// <param name="source">Source observable sequence.</param>
10549 /// <returns>The enumerable sequence that blocks upon each iteration until the next element in the observable source sequence becomes available.</returns>
10550 /// <exception cref="T:System.ArgumentNullException">
10551 /// <paramref name="source" /> is null.</exception>
10552 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
10553 public static IQueryable<TSource> Next<TSource>(this IQbservable<TSource> source)
10554 {
10555 if (source == null)
10556 throw new ArgumentNullException("source");
10557
10558 return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
10559 Expression.Call(
10560 null,
10561 #if CRIPPLED_REFLECTION
10562 InfoOf(() => Qbservable.Next<TSource>(default(IQbservable<TSource>))),
10563 #else
10564 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10565 #endif
10566 source.Expression
10567 )
10568 );
10569 }
10570
10571 /// <summary>
10572 /// Wraps the source sequence in order to run its observer callbacks on the specified synchronization context.
10573 /// </summary>
10574 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10575 /// <param name="source">Source sequence.</param>
10576 /// <param name="context">Synchronization context to notify observers on.</param>
10577 /// <returns>The source sequence whose observations happen on the specified synchronization context.</returns>
10578 /// <exception cref="T:System.ArgumentNullException">
10579 /// <paramref name="source" /> or <paramref name="context" /> is null.</exception>
10580 /// <remarks>
10581 /// This only invokes observer callbacks on a synchronization context. In case the subscription and/or unsubscription actions have side-effects
10582 /// that require to be run on a synchronization context, use <see cref="M:System.Reactive.Linq.Observable.SubscribeOn``1(System.IObservable{``0},System.Threading.SynchronizationContext)" />.
10583 /// </remarks>
10584 public static IQbservable<TSource> ObserveOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)
10585 {
10586 if (source == null)
10587 throw new ArgumentNullException("source");
10588 if (context == null)
10589 throw new ArgumentNullException("context");
10590
10591 return source.Provider.CreateQuery<TSource>(
10592 Expression.Call(
10593 null,
10594 #if CRIPPLED_REFLECTION
10595 InfoOf(() => Qbservable.ObserveOn<TSource>(default(IQbservable<TSource>), default(SynchronizationContext))),
10596 #else
10597 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10598 #endif
10599 source.Expression,
10600 Expression.Constant(context, typeof(SynchronizationContext))
10601 )
10602 );
10603 }
10604
10605 /// <summary>
10606 /// Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
10607 /// </summary>
10608 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10609 /// <param name="source">Source sequence.</param>
10610 /// <param name="scheduler">Scheduler to notify observers on.</param>
10611 /// <returns>The source sequence whose observations happen on the specified scheduler.</returns>
10612 /// <exception cref="T:System.ArgumentNullException">
10613 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
10614 /// <remarks>
10615 /// This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
10616 /// that require to be run on a scheduler, use <see cref="M:System.Reactive.Linq.Observable.SubscribeOn``1(System.IObservable{``0},System.Reactive.Concurrency.IScheduler)" />.
10617 /// </remarks>
10618 public static IQbservable<TSource> ObserveOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
10619 {
10620 if (source == null)
10621 throw new ArgumentNullException("source");
10622 if (scheduler == null)
10623 throw new ArgumentNullException("scheduler");
10624
10625 return source.Provider.CreateQuery<TSource>(
10626 Expression.Call(
10627 null,
10628 #if CRIPPLED_REFLECTION
10629 InfoOf(() => Qbservable.ObserveOn<TSource>(default(IQbservable<TSource>), default(IScheduler))),
10630 #else
10631 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10632 #endif
10633 source.Expression,
10634 Expression.Constant(scheduler, typeof(IScheduler))
10635 )
10636 );
10637 }
10638
10639 /// <summary>
10640 /// Filters the elements of an observable sequence based on the specified type.
10641 /// </summary>
10642 /// <typeparam name="TResult">The type to filter the elements in the source sequence on.</typeparam>
10643 /// <param name="source">The observable sequence that contains the elements to be filtered.</param>
10644 /// <returns>An observable sequence that contains elements from the input sequence of type TResult.</returns>
10645 /// <exception cref="T:System.ArgumentNullException">
10646 /// <paramref name="source" /> is null.</exception>
10647 public static IQbservable<TResult> OfType<TResult>(this IQbservable<object> source)
10648 {
10649 if (source == null)
10650 throw new ArgumentNullException("source");
10651
10652 return source.Provider.CreateQuery<TResult>(
10653 Expression.Call(
10654 null,
10655 #if CRIPPLED_REFLECTION
10656 InfoOf(() => Qbservable.OfType<TResult>(default(IQbservable<object>))),
10657 #else
10658 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
10659 #endif
10660 source.Expression
10661 )
10662 );
10663 }
10664
10665 /// <summary>
10666 /// Concatenates the second observable sequence to the first observable sequence upon successful or exceptional termination of the first.
10667 /// </summary>
10668 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
10669 /// <param name="first">First observable sequence whose exception (if any) is caught.</param>
10670 /// <param name="second">Second observable sequence used to produce results after the first sequence terminates.</param>
10671 /// <returns>An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.</returns>
10672 /// <exception cref="T:System.ArgumentNullException">
10673 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
10674 public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
10675 {
10676 if (first == null)
10677 throw new ArgumentNullException("first");
10678 if (second == null)
10679 throw new ArgumentNullException("second");
10680
10681 return first.Provider.CreateQuery<TSource>(
10682 Expression.Call(
10683 null,
10684 #if CRIPPLED_REFLECTION
10685 InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
10686 #else
10687 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10688 #endif
10689 first.Expression,
10690 GetSourceExpression(second)
10691 )
10692 );
10693 }
10694
10695 /// <summary>
10696 /// Concatenates all of the specified observable sequences, even if the previous observable sequence terminated exceptionally.
10697 /// </summary>
10698 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10699 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
10700 /// <param name="sources">Observable sequences to concatenate.</param>
10701 /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
10702 /// <exception cref="T:System.ArgumentNullException">
10703 /// <paramref name="sources" /> is null.</exception>
10704 public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
10705 {
10706 if (provider == null)
10707 throw new ArgumentNullException("provider");
10708 if (sources == null)
10709 throw new ArgumentNullException("sources");
10710
10711 return provider.CreateQuery<TSource>(
10712 Expression.Call(
10713 null,
10714 #if CRIPPLED_REFLECTION
10715 InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
10716 #else
10717 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10718 #endif
10719 Expression.Constant(provider, typeof(IQbservableProvider)),
10720 GetSourceExpression(sources)
10721 )
10722 );
10723 }
10724
10725 /// <summary>
10726 /// Concatenates all observable sequences in the given enumerable sequence, even if the previous observable sequence terminated exceptionally.
10727 /// </summary>
10728 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10729 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
10730 /// <param name="sources">Observable sequences to concatenate.</param>
10731 /// <returns>An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.</returns>
10732 /// <exception cref="T:System.ArgumentNullException">
10733 /// <paramref name="sources" /> is null.</exception>
10734 public static IQbservable<TSource> OnErrorResumeNext<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
10735 {
10736 if (provider == null)
10737 throw new ArgumentNullException("provider");
10738 if (sources == null)
10739 throw new ArgumentNullException("sources");
10740
10741 return provider.CreateQuery<TSource>(
10742 Expression.Call(
10743 null,
10744 #if CRIPPLED_REFLECTION
10745 InfoOf(() => Qbservable.OnErrorResumeNext<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
10746 #else
10747 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10748 #endif
10749 Expression.Constant(provider, typeof(IQbservableProvider)),
10750 GetSourceExpression(sources)
10751 )
10752 );
10753 }
10754
10755 /// <summary>
10756 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
10757 /// This operator is a specialization of Multicast using a regular <see cref="T:System.Reactive.Subjects.Subject`1" />.
10758 /// </summary>
10759 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10760 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
10761 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
10762 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.</param>
10763 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
10764 /// <exception cref="T:System.ArgumentNullException">
10765 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10766 /// <seealso cref="T:System.Reactive.Subjects.Subject`1" />
10767 public static IQbservable<TResult> Publish<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
10768 {
10769 if (source == null)
10770 throw new ArgumentNullException("source");
10771 if (selector == null)
10772 throw new ArgumentNullException("selector");
10773
10774 return source.Provider.CreateQuery<TResult>(
10775 Expression.Call(
10776 null,
10777 #if CRIPPLED_REFLECTION
10778 InfoOf(() => Qbservable.Publish<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
10779 #else
10780 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
10781 #endif
10782 source.Expression,
10783 selector
10784 )
10785 );
10786 }
10787
10788 /// <summary>
10789 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
10790 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.BehaviorSubject`1" />.
10791 /// </summary>
10792 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10793 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
10794 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
10795 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.</param>
10796 /// <param name="initialValue">Initial value received by observers upon subscription.</param>
10797 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
10798 /// <exception cref="T:System.ArgumentNullException">
10799 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10800 /// <seealso cref="T:System.Reactive.Subjects.BehaviorSubject`1" />
10801 public static IQbservable<TResult> Publish<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TSource initialValue)
10802 {
10803 if (source == null)
10804 throw new ArgumentNullException("source");
10805 if (selector == null)
10806 throw new ArgumentNullException("selector");
10807
10808 return source.Provider.CreateQuery<TResult>(
10809 Expression.Call(
10810 null,
10811 #if CRIPPLED_REFLECTION
10812 InfoOf(() => Qbservable.Publish<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TSource))),
10813 #else
10814 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
10815 #endif
10816 source.Expression,
10817 selector,
10818 Expression.Constant(initialValue, typeof(TSource))
10819 )
10820 );
10821 }
10822
10823 /// <summary>
10824 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
10825 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.AsyncSubject`1" />.
10826 /// </summary>
10827 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10828 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
10829 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
10830 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.</param>
10831 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
10832 /// <exception cref="T:System.ArgumentNullException">
10833 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
10834 /// <seealso cref="T:System.Reactive.Subjects.AsyncSubject`1" />
10835 public static IQbservable<TResult> PublishLast<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
10836 {
10837 if (source == null)
10838 throw new ArgumentNullException("source");
10839 if (selector == null)
10840 throw new ArgumentNullException("selector");
10841
10842 return source.Provider.CreateQuery<TResult>(
10843 Expression.Call(
10844 null,
10845 #if CRIPPLED_REFLECTION
10846 InfoOf(() => Qbservable.PublishLast<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
10847 #else
10848 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
10849 #endif
10850 source.Expression,
10851 selector
10852 )
10853 );
10854 }
10855
10856 /// <summary>
10857 /// Generates an observable sequence of integral numbers within a specified range.
10858 /// </summary>
10859 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10860 /// <param name="start">The value of the first integer in the sequence.</param>
10861 /// <param name="count">The number of sequential integers to generate.</param>
10862 /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
10863 /// <exception cref="T:System.ArgumentOutOfRangeException">
10864 /// <paramref name="count" /> is less than zero. -or- <paramref name="start" /> + <paramref name="count" /> - 1 is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
10865 public static IQbservable<int> Range(this IQbservableProvider provider, int start, int count)
10866 {
10867 if (provider == null)
10868 throw new ArgumentNullException("provider");
10869
10870 return provider.CreateQuery<int>(
10871 Expression.Call(
10872 null,
10873 #if CRIPPLED_REFLECTION
10874 InfoOf(() => Qbservable.Range(default(IQbservableProvider), default(int), default(int))),
10875 #else
10876 (MethodInfo)MethodInfo.GetCurrentMethod(),
10877 #endif
10878 Expression.Constant(provider, typeof(IQbservableProvider)),
10879 Expression.Constant(start, typeof(int)),
10880 Expression.Constant(count, typeof(int))
10881 )
10882 );
10883 }
10884
10885 /// <summary>
10886 /// Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
10887 /// </summary>
10888 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10889 /// <param name="start">The value of the first integer in the sequence.</param>
10890 /// <param name="count">The number of sequential integers to generate.</param>
10891 /// <param name="scheduler">Scheduler to run the generator loop on.</param>
10892 /// <returns>An observable sequence that contains a range of sequential integral numbers.</returns>
10893 /// <exception cref="T:System.ArgumentOutOfRangeException">
10894 /// <paramref name="count" /> is less than zero. -or- <paramref name="start" /> + <paramref name="count" /> - 1 is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
10895 /// <exception cref="T:System.ArgumentNullException">
10896 /// <paramref name="scheduler" /> is null.</exception>
10897 public static IQbservable<int> Range(this IQbservableProvider provider, int start, int count, IScheduler scheduler)
10898 {
10899 if (provider == null)
10900 throw new ArgumentNullException("provider");
10901 if (scheduler == null)
10902 throw new ArgumentNullException("scheduler");
10903
10904 return provider.CreateQuery<int>(
10905 Expression.Call(
10906 null,
10907 #if CRIPPLED_REFLECTION
10908 InfoOf(() => Qbservable.Range(default(IQbservableProvider), default(int), default(int), default(IScheduler))),
10909 #else
10910 (MethodInfo)MethodInfo.GetCurrentMethod(),
10911 #endif
10912 Expression.Constant(provider, typeof(IQbservableProvider)),
10913 Expression.Constant(start, typeof(int)),
10914 Expression.Constant(count, typeof(int)),
10915 Expression.Constant(scheduler, typeof(IScheduler))
10916 )
10917 );
10918 }
10919
10920 /// <summary>
10921 /// Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.
10922 /// </summary>
10923 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10924 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
10925 /// <param name="source">Connectable observable sequence.</param>
10926 /// <returns>An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.</returns>
10927 /// <exception cref="T:System.ArgumentNullException">
10928 /// <paramref name="source" /> is null.</exception>
10929 public static IQbservable<TSource> RefCount<TSource>(this IQbservableProvider provider, IConnectableObservable<TSource> source)
10930 {
10931 if (provider == null)
10932 throw new ArgumentNullException("provider");
10933 if (source == null)
10934 throw new ArgumentNullException("source");
10935
10936 return provider.CreateQuery<TSource>(
10937 Expression.Call(
10938 null,
10939 #if CRIPPLED_REFLECTION
10940 InfoOf(() => Qbservable.RefCount<TSource>(default(IQbservableProvider), default(IConnectableObservable<TSource>))),
10941 #else
10942 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
10943 #endif
10944 Expression.Constant(provider, typeof(IQbservableProvider)),
10945 Expression.Constant(source, typeof(IConnectableObservable<TSource>))
10946 )
10947 );
10948 }
10949
10950 /// <summary>
10951 /// Generates an observable sequence that repeats the given element infinitely.
10952 /// </summary>
10953 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10954 /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
10955 /// <param name="value">Element to repeat.</param>
10956 /// <returns>An observable sequence that repeats the given element infinitely.</returns>
10957 public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value)
10958 {
10959 if (provider == null)
10960 throw new ArgumentNullException("provider");
10961
10962 return provider.CreateQuery<TResult>(
10963 Expression.Call(
10964 null,
10965 #if CRIPPLED_REFLECTION
10966 InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult))),
10967 #else
10968 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
10969 #endif
10970 Expression.Constant(provider, typeof(IQbservableProvider)),
10971 Expression.Constant(value, typeof(TResult))
10972 )
10973 );
10974 }
10975
10976 /// <summary>
10977 /// Generates an observable sequence that repeats the given element the specified number of times.
10978 /// </summary>
10979 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
10980 /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
10981 /// <param name="value">Element to repeat.</param>
10982 /// <param name="repeatCount">Number of times to repeat the element.</param>
10983 /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
10984 /// <exception cref="T:System.ArgumentOutOfRangeException">
10985 /// <paramref name="repeatCount" /> is less than zero.</exception>
10986 public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, int repeatCount)
10987 {
10988 if (provider == null)
10989 throw new ArgumentNullException("provider");
10990
10991 return provider.CreateQuery<TResult>(
10992 Expression.Call(
10993 null,
10994 #if CRIPPLED_REFLECTION
10995 InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(int))),
10996 #else
10997 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
10998 #endif
10999 Expression.Constant(provider, typeof(IQbservableProvider)),
11000 Expression.Constant(value, typeof(TResult)),
11001 Expression.Constant(repeatCount, typeof(int))
11002 )
11003 );
11004 }
11005
11006 /// <summary>
11007 /// Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
11008 /// </summary>
11009 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
11010 /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
11011 /// <param name="value">Element to repeat.</param>
11012 /// <param name="repeatCount">Number of times to repeat the element.</param>
11013 /// <param name="scheduler">Scheduler to run the producer loop on.</param>
11014 /// <returns>An observable sequence that repeats the given element the specified number of times.</returns>
11015 /// <exception cref="T:System.ArgumentOutOfRangeException">
11016 /// <paramref name="repeatCount" /> is less than zero.</exception>
11017 /// <exception cref="T:System.ArgumentNullException">
11018 /// <paramref name="scheduler" /> is null.</exception>
11019 public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, int repeatCount, IScheduler scheduler)
11020 {
11021 if (provider == null)
11022 throw new ArgumentNullException("provider");
11023 if (scheduler == null)
11024 throw new ArgumentNullException("scheduler");
11025
11026 return provider.CreateQuery<TResult>(
11027 Expression.Call(
11028 null,
11029 #if CRIPPLED_REFLECTION
11030 InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(int), default(IScheduler))),
11031 #else
11032 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
11033 #endif
11034 Expression.Constant(provider, typeof(IQbservableProvider)),
11035 Expression.Constant(value, typeof(TResult)),
11036 Expression.Constant(repeatCount, typeof(int)),
11037 Expression.Constant(scheduler, typeof(IScheduler))
11038 )
11039 );
11040 }
11041
11042 /// <summary>
11043 /// Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.
11044 /// </summary>
11045 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
11046 /// <typeparam name="TResult">The type of the element that will be repeated in the produced sequence.</typeparam>
11047 /// <param name="value">Element to repeat.</param>
11048 /// <param name="scheduler">Scheduler to run the producer loop on.</param>
11049 /// <returns>An observable sequence that repeats the given element infinitely.</returns>
11050 /// <exception cref="T:System.ArgumentNullException">
11051 /// <paramref name="scheduler" /> is null.</exception>
11052 public static IQbservable<TResult> Repeat<TResult>(this IQbservableProvider provider, TResult value, IScheduler scheduler)
11053 {
11054 if (provider == null)
11055 throw new ArgumentNullException("provider");
11056 if (scheduler == null)
11057 throw new ArgumentNullException("scheduler");
11058
11059 return provider.CreateQuery<TResult>(
11060 Expression.Call(
11061 null,
11062 #if CRIPPLED_REFLECTION
11063 InfoOf(() => Qbservable.Repeat<TResult>(default(IQbservableProvider), default(TResult), default(IScheduler))),
11064 #else
11065 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
11066 #endif
11067 Expression.Constant(provider, typeof(IQbservableProvider)),
11068 Expression.Constant(value, typeof(TResult)),
11069 Expression.Constant(scheduler, typeof(IScheduler))
11070 )
11071 );
11072 }
11073
11074 /// <summary>
11075 /// Repeats the observable sequence indefinitely.
11076 /// </summary>
11077 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11078 /// <param name="source">Observable sequence to repeat.</param>
11079 /// <returns>The observable sequence producing the elements of the given sequence repeatedly and sequentially.</returns>
11080 /// <exception cref="T:System.ArgumentNullException">
11081 /// <paramref name="source" /> is null.</exception>
11082 public static IQbservable<TSource> Repeat<TSource>(this IQbservable<TSource> source)
11083 {
11084 if (source == null)
11085 throw new ArgumentNullException("source");
11086
11087 return source.Provider.CreateQuery<TSource>(
11088 Expression.Call(
11089 null,
11090 #if CRIPPLED_REFLECTION
11091 InfoOf(() => Qbservable.Repeat<TSource>(default(IQbservable<TSource>))),
11092 #else
11093 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11094 #endif
11095 source.Expression
11096 )
11097 );
11098 }
11099
11100 /// <summary>
11101 /// Repeats the observable sequence a specified number of times.
11102 /// </summary>
11103 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11104 /// <param name="source">Observable sequence to repeat.</param>
11105 /// <param name="repeatCount">Number of times to repeat the sequence.</param>
11106 /// <returns>The observable sequence producing the elements of the given sequence repeatedly.</returns>
11107 /// <exception cref="T:System.ArgumentNullException">
11108 /// <paramref name="source" /> is null.</exception>
11109 /// <exception cref="T:System.ArgumentOutOfRangeException">
11110 /// <paramref name="repeatCount" /> is less than zero.</exception>
11111 public static IQbservable<TSource> Repeat<TSource>(this IQbservable<TSource> source, int repeatCount)
11112 {
11113 if (source == null)
11114 throw new ArgumentNullException("source");
11115
11116 return source.Provider.CreateQuery<TSource>(
11117 Expression.Call(
11118 null,
11119 #if CRIPPLED_REFLECTION
11120 InfoOf(() => Qbservable.Repeat<TSource>(default(IQbservable<TSource>), default(int))),
11121 #else
11122 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11123 #endif
11124 source.Expression,
11125 Expression.Constant(repeatCount, typeof(int))
11126 )
11127 );
11128 }
11129
11130 /// <summary>
11131 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
11132 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11133 /// </summary>
11134 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11135 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11136 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11137 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
11138 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11139 /// <exception cref="T:System.ArgumentNullException">
11140 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11141 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11142 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector)
11143 {
11144 if (source == null)
11145 throw new ArgumentNullException("source");
11146 if (selector == null)
11147 throw new ArgumentNullException("selector");
11148
11149 return source.Provider.CreateQuery<TResult>(
11150 Expression.Call(
11151 null,
11152 #if CRIPPLED_REFLECTION
11153 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>))),
11154 #else
11155 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11156 #endif
11157 source.Expression,
11158 selector
11159 )
11160 );
11161 }
11162
11163 /// <summary>
11164 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
11165 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11166 /// </summary>
11167 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11168 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11169 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11170 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11171 /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
11172 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11173 /// <exception cref="T:System.ArgumentNullException">
11174 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11175 /// <exception cref="T:System.ArgumentOutOfRangeException">
11176 /// <paramref name="bufferSize" /> is less than zero.</exception>
11177 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11178 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize)
11179 {
11180 if (source == null)
11181 throw new ArgumentNullException("source");
11182 if (selector == null)
11183 throw new ArgumentNullException("selector");
11184
11185 return source.Provider.CreateQuery<TResult>(
11186 Expression.Call(
11187 null,
11188 #if CRIPPLED_REFLECTION
11189 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int))),
11190 #else
11191 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11192 #endif
11193 source.Expression,
11194 selector,
11195 Expression.Constant(bufferSize, typeof(int))
11196 )
11197 );
11198 }
11199
11200 /// <summary>
11201 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum element count for the replay buffer.
11202 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11203 /// </summary>
11204 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11205 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11206 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11207 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11208 /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
11209 /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
11210 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11211 /// <exception cref="T:System.ArgumentNullException">
11212 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
11213 /// <exception cref="T:System.ArgumentOutOfRangeException">
11214 /// <paramref name="bufferSize" /> is less than zero.</exception>
11215 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11216 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, IScheduler scheduler)
11217 {
11218 if (source == null)
11219 throw new ArgumentNullException("source");
11220 if (selector == null)
11221 throw new ArgumentNullException("selector");
11222 if (scheduler == null)
11223 throw new ArgumentNullException("scheduler");
11224
11225 return source.Provider.CreateQuery<TResult>(
11226 Expression.Call(
11227 null,
11228 #if CRIPPLED_REFLECTION
11229 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(IScheduler))),
11230 #else
11231 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11232 #endif
11233 source.Expression,
11234 selector,
11235 Expression.Constant(bufferSize, typeof(int)),
11236 Expression.Constant(scheduler, typeof(IScheduler))
11237 )
11238 );
11239 }
11240
11241 /// <summary>
11242 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
11243 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11244 /// </summary>
11245 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11246 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11247 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11248 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11249 /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
11250 /// <param name="window">Maximum time length of the replay buffer.</param>
11251 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11252 /// <exception cref="T:System.ArgumentNullException">
11253 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11254 /// <exception cref="T:System.ArgumentOutOfRangeException">
11255 /// <paramref name="bufferSize" /> is less than zero.</exception>
11256 /// <exception cref="T:System.ArgumentOutOfRangeException">
11257 /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
11258 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11259 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, TimeSpan window)
11260 {
11261 if (source == null)
11262 throw new ArgumentNullException("source");
11263 if (selector == null)
11264 throw new ArgumentNullException("selector");
11265
11266 return source.Provider.CreateQuery<TResult>(
11267 Expression.Call(
11268 null,
11269 #if CRIPPLED_REFLECTION
11270 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(TimeSpan))),
11271 #else
11272 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11273 #endif
11274 source.Expression,
11275 selector,
11276 Expression.Constant(bufferSize, typeof(int)),
11277 Expression.Constant(window, typeof(TimeSpan))
11278 )
11279 );
11280 }
11281
11282 /// <summary>
11283 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length and element count for the replay buffer.
11284 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11285 /// </summary>
11286 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11287 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11288 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11289 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11290 /// <param name="bufferSize">Maximum element count of the replay buffer.</param>
11291 /// <param name="window">Maximum time length of the replay buffer.</param>
11292 /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
11293 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11294 /// <exception cref="T:System.ArgumentNullException">
11295 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
11296 /// <exception cref="T:System.ArgumentOutOfRangeException">
11297 /// <paramref name="bufferSize" /> is less than zero.</exception>
11298 /// <exception cref="T:System.ArgumentOutOfRangeException">
11299 /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
11300 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11301 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, int bufferSize, TimeSpan window, IScheduler scheduler)
11302 {
11303 if (source == null)
11304 throw new ArgumentNullException("source");
11305 if (selector == null)
11306 throw new ArgumentNullException("selector");
11307 if (scheduler == null)
11308 throw new ArgumentNullException("scheduler");
11309
11310 return source.Provider.CreateQuery<TResult>(
11311 Expression.Call(
11312 null,
11313 #if CRIPPLED_REFLECTION
11314 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(int), default(TimeSpan), default(IScheduler))),
11315 #else
11316 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11317 #endif
11318 source.Expression,
11319 selector,
11320 Expression.Constant(bufferSize, typeof(int)),
11321 Expression.Constant(window, typeof(TimeSpan)),
11322 Expression.Constant(scheduler, typeof(IScheduler))
11323 )
11324 );
11325 }
11326
11327 /// <summary>
11328 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
11329 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11330 /// </summary>
11331 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11332 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11333 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11334 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source.</param>
11335 /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
11336 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11337 /// <exception cref="T:System.ArgumentNullException">
11338 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
11339 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11340 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, IScheduler scheduler)
11341 {
11342 if (source == null)
11343 throw new ArgumentNullException("source");
11344 if (selector == null)
11345 throw new ArgumentNullException("selector");
11346 if (scheduler == null)
11347 throw new ArgumentNullException("scheduler");
11348
11349 return source.Provider.CreateQuery<TResult>(
11350 Expression.Call(
11351 null,
11352 #if CRIPPLED_REFLECTION
11353 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(IScheduler))),
11354 #else
11355 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11356 #endif
11357 source.Expression,
11358 selector,
11359 Expression.Constant(scheduler, typeof(IScheduler))
11360 )
11361 );
11362 }
11363
11364 /// <summary>
11365 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
11366 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11367 /// </summary>
11368 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11369 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11370 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11371 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11372 /// <param name="window">Maximum time length of the replay buffer.</param>
11373 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11374 /// <exception cref="T:System.ArgumentNullException">
11375 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11376 /// <exception cref="T:System.ArgumentOutOfRangeException">
11377 /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
11378 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11379 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TimeSpan window)
11380 {
11381 if (source == null)
11382 throw new ArgumentNullException("source");
11383 if (selector == null)
11384 throw new ArgumentNullException("selector");
11385
11386 return source.Provider.CreateQuery<TResult>(
11387 Expression.Call(
11388 null,
11389 #if CRIPPLED_REFLECTION
11390 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TimeSpan))),
11391 #else
11392 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11393 #endif
11394 source.Expression,
11395 selector,
11396 Expression.Constant(window, typeof(TimeSpan))
11397 )
11398 );
11399 }
11400
11401 /// <summary>
11402 /// Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
11403 /// This operator is a specialization of Multicast using a <see cref="T:System.Reactive.Subjects.ReplaySubject`1" />.
11404 /// </summary>
11405 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11406 /// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
11407 /// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
11408 /// <param name="selector">Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.</param>
11409 /// <param name="window">Maximum time length of the replay buffer.</param>
11410 /// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
11411 /// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
11412 /// <exception cref="T:System.ArgumentNullException">
11413 /// <paramref name="source" /> or <paramref name="selector" /> or <paramref name="scheduler" /> is null.</exception>
11414 /// <exception cref="T:System.ArgumentOutOfRangeException">
11415 /// <paramref name="window" /> is less than TimeSpan.Zero.</exception>
11416 /// <seealso cref="T:System.Reactive.Subjects.ReplaySubject`1" />
11417 public static IQbservable<TResult> Replay<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<IObservable<TSource>, IObservable<TResult>>> selector, TimeSpan window, IScheduler scheduler)
11418 {
11419 if (source == null)
11420 throw new ArgumentNullException("source");
11421 if (selector == null)
11422 throw new ArgumentNullException("selector");
11423 if (scheduler == null)
11424 throw new ArgumentNullException("scheduler");
11425
11426 return source.Provider.CreateQuery<TResult>(
11427 Expression.Call(
11428 null,
11429 #if CRIPPLED_REFLECTION
11430 InfoOf(() => Qbservable.Replay<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TSource>, IObservable<TResult>>>), default(TimeSpan), default(IScheduler))),
11431 #else
11432 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11433 #endif
11434 source.Expression,
11435 selector,
11436 Expression.Constant(window, typeof(TimeSpan)),
11437 Expression.Constant(scheduler, typeof(IScheduler))
11438 )
11439 );
11440 }
11441
11442 /// <summary>
11443 /// Repeats the source observable sequence until it successfully terminates.
11444 /// </summary>
11445 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11446 /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
11447 /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
11448 /// <exception cref="T:System.ArgumentNullException">
11449 /// <paramref name="source" /> is null.</exception>
11450 public static IQbservable<TSource> Retry<TSource>(this IQbservable<TSource> source)
11451 {
11452 if (source == null)
11453 throw new ArgumentNullException("source");
11454
11455 return source.Provider.CreateQuery<TSource>(
11456 Expression.Call(
11457 null,
11458 #if CRIPPLED_REFLECTION
11459 InfoOf(() => Qbservable.Retry<TSource>(default(IQbservable<TSource>))),
11460 #else
11461 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11462 #endif
11463 source.Expression
11464 )
11465 );
11466 }
11467
11468 /// <summary>
11469 /// Repeats the source observable sequence the specified number of times or until it successfully terminates.
11470 /// </summary>
11471 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11472 /// <param name="source">Observable sequence to repeat until it successfully terminates.</param>
11473 /// <param name="retryCount">Number of times to repeat the sequence.</param>
11474 /// <returns>An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.</returns>
11475 /// <exception cref="T:System.ArgumentNullException">
11476 /// <paramref name="source" /> is null.</exception>
11477 /// <exception cref="T:System.ArgumentOutOfRangeException">
11478 /// <paramref name="retryCount" /> is less than zero.</exception>
11479 public static IQbservable<TSource> Retry<TSource>(this IQbservable<TSource> source, int retryCount)
11480 {
11481 if (source == null)
11482 throw new ArgumentNullException("source");
11483
11484 return source.Provider.CreateQuery<TSource>(
11485 Expression.Call(
11486 null,
11487 #if CRIPPLED_REFLECTION
11488 InfoOf(() => Qbservable.Retry<TSource>(default(IQbservable<TSource>), default(int))),
11489 #else
11490 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11491 #endif
11492 source.Expression,
11493 Expression.Constant(retryCount, typeof(int))
11494 )
11495 );
11496 }
11497
11498 /// <summary>
11499 /// Returns an observable sequence that contains a single element.
11500 /// </summary>
11501 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
11502 /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
11503 /// <param name="value">Single element in the resulting observable sequence.</param>
11504 /// <returns>An observable sequence containing the single specified element.</returns>
11505 public static IQbservable<TResult> Return<TResult>(this IQbservableProvider provider, TResult value)
11506 {
11507 if (provider == null)
11508 throw new ArgumentNullException("provider");
11509
11510 return provider.CreateQuery<TResult>(
11511 Expression.Call(
11512 null,
11513 #if CRIPPLED_REFLECTION
11514 InfoOf(() => Qbservable.Return<TResult>(default(IQbservableProvider), default(TResult))),
11515 #else
11516 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
11517 #endif
11518 Expression.Constant(provider, typeof(IQbservableProvider)),
11519 Expression.Constant(value, typeof(TResult))
11520 )
11521 );
11522 }
11523
11524 /// <summary>
11525 /// Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
11526 /// </summary>
11527 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
11528 /// <typeparam name="TResult">The type of the element that will be returned in the produced sequence.</typeparam>
11529 /// <param name="value">Single element in the resulting observable sequence.</param>
11530 /// <param name="scheduler">Scheduler to send the single element on.</param>
11531 /// <returns>An observable sequence containing the single specified element.</returns>
11532 /// <exception cref="T:System.ArgumentNullException">
11533 /// <paramref name="scheduler" /> is null.</exception>
11534 public static IQbservable<TResult> Return<TResult>(this IQbservableProvider provider, TResult value, IScheduler scheduler)
11535 {
11536 if (provider == null)
11537 throw new ArgumentNullException("provider");
11538 if (scheduler == null)
11539 throw new ArgumentNullException("scheduler");
11540
11541 return provider.CreateQuery<TResult>(
11542 Expression.Call(
11543 null,
11544 #if CRIPPLED_REFLECTION
11545 InfoOf(() => Qbservable.Return<TResult>(default(IQbservableProvider), default(TResult), default(IScheduler))),
11546 #else
11547 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
11548 #endif
11549 Expression.Constant(provider, typeof(IQbservableProvider)),
11550 Expression.Constant(value, typeof(TResult)),
11551 Expression.Constant(scheduler, typeof(IScheduler))
11552 )
11553 );
11554 }
11555
11556 /// <summary>
11557 /// Samples the observable sequence at each interval.
11558 /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
11559 /// </summary>
11560 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11561 /// <param name="source">Source sequence to sample.</param>
11562 /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
11563 /// <returns>Sampled observable sequence.</returns>
11564 /// <exception cref="T:System.ArgumentNullException">
11565 /// <paramref name="source" /> is null.</exception>
11566 /// <exception cref="T:System.ArgumentOutOfRangeException">
11567 /// <paramref name="interval" /> is less than TimeSpan.Zero.</exception>
11568 /// <remarks>
11569 /// Specifying a TimeSpan.Zero value for <paramref name="interval" /> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
11570 /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
11571 /// </remarks>
11572 public static IQbservable<TSource> Sample<TSource>(this IQbservable<TSource> source, TimeSpan interval)
11573 {
11574 if (source == null)
11575 throw new ArgumentNullException("source");
11576
11577 return source.Provider.CreateQuery<TSource>(
11578 Expression.Call(
11579 null,
11580 #if CRIPPLED_REFLECTION
11581 InfoOf(() => Qbservable.Sample<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
11582 #else
11583 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11584 #endif
11585 source.Expression,
11586 Expression.Constant(interval, typeof(TimeSpan))
11587 )
11588 );
11589 }
11590
11591 /// <summary>
11592 /// Samples the observable sequence at each interval, using the specified scheduler to run sampling timers.
11593 /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
11594 /// </summary>
11595 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11596 /// <param name="source">Source sequence to sample.</param>
11597 /// <param name="interval">Interval at which to sample. If this value is equal to TimeSpan.Zero, the scheduler will continuously sample the stream.</param>
11598 /// <param name="scheduler">Scheduler to run the sampling timer on.</param>
11599 /// <returns>Sampled observable sequence.</returns>
11600 /// <exception cref="T:System.ArgumentNullException">
11601 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
11602 /// <exception cref="T:System.ArgumentOutOfRangeException">
11603 /// <paramref name="interval" /> is less than TimeSpan.Zero.</exception>
11604 /// <remarks>
11605 /// Specifying a TimeSpan.Zero value for <paramref name="interval" /> doesn't guarantee all source sequence elements will be preserved. This is a side-effect
11606 /// of the asynchrony introduced by the scheduler, where the sampling action may not execute immediately, despite the TimeSpan.Zero due time.
11607 /// </remarks>
11608 public static IQbservable<TSource> Sample<TSource>(this IQbservable<TSource> source, TimeSpan interval, IScheduler scheduler)
11609 {
11610 if (source == null)
11611 throw new ArgumentNullException("source");
11612 if (scheduler == null)
11613 throw new ArgumentNullException("scheduler");
11614
11615 return source.Provider.CreateQuery<TSource>(
11616 Expression.Call(
11617 null,
11618 #if CRIPPLED_REFLECTION
11619 InfoOf(() => Qbservable.Sample<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
11620 #else
11621 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11622 #endif
11623 source.Expression,
11624 Expression.Constant(interval, typeof(TimeSpan)),
11625 Expression.Constant(scheduler, typeof(IScheduler))
11626 )
11627 );
11628 }
11629
11630 /// <summary>
11631 /// Samples the source observable sequence using a samper observable sequence producing sampling ticks.
11632 /// Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.
11633 /// </summary>
11634 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11635 /// <typeparam name="TSample">The type of the elements in the sampling sequence.</typeparam>
11636 /// <param name="source">Source sequence to sample.</param>
11637 /// <param name="sampler">Sampling tick sequence.</param>
11638 /// <returns>Sampled observable sequence.</returns>
11639 /// <exception cref="T:System.ArgumentNullException">
11640 /// <paramref name="source" /> or <paramref name="sampler" /> is null.</exception>
11641 public static IQbservable<TSource> Sample<TSource, TSample>(this IQbservable<TSource> source, IObservable<TSample> sampler)
11642 {
11643 if (source == null)
11644 throw new ArgumentNullException("source");
11645 if (sampler == null)
11646 throw new ArgumentNullException("sampler");
11647
11648 return source.Provider.CreateQuery<TSource>(
11649 Expression.Call(
11650 null,
11651 #if CRIPPLED_REFLECTION
11652 InfoOf(() => Qbservable.Sample<TSource, TSample>(default(IQbservable<TSource>), default(IObservable<TSample>))),
11653 #else
11654 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TSample)),
11655 #endif
11656 source.Expression,
11657 GetSourceExpression(sampler)
11658 )
11659 );
11660 }
11661
11662 /// <summary>
11663 /// Applies an accumulator function over an observable sequence and returns each intermediate result.
11664 /// For aggregation behavior with no intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Aggregate``1(System.IObservable{``0},System.Func{``0,``0,``0})" />.
11665 /// </summary>
11666 /// <typeparam name="TSource">The type of the elements in the source sequence and the result of the aggregation.</typeparam>
11667 /// <param name="source">An observable sequence to accumulate over.</param>
11668 /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
11669 /// <returns>An observable sequence containing the accumulated values.</returns>
11670 /// <exception cref="T:System.ArgumentNullException">
11671 /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
11672 public static IQbservable<TSource> Scan<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
11673 {
11674 if (source == null)
11675 throw new ArgumentNullException("source");
11676 if (accumulator == null)
11677 throw new ArgumentNullException("accumulator");
11678
11679 return source.Provider.CreateQuery<TSource>(
11680 Expression.Call(
11681 null,
11682 #if CRIPPLED_REFLECTION
11683 InfoOf(() => Qbservable.Scan<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))),
11684 #else
11685 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
11686 #endif
11687 source.Expression,
11688 accumulator
11689 )
11690 );
11691 }
11692
11693 /// <summary>
11694 /// Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.
11695 /// For aggregation behavior with no intermediate results, see <see cref="M:System.Reactive.Linq.Observable.Aggregate``2(System.IObservable{``0},``1,System.Func{``1,``0,``1})" />.
11696 /// </summary>
11697 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11698 /// <typeparam name="TAccumulate">The type of the result of the aggregation.</typeparam>
11699 /// <param name="source">An observable sequence to accumulate over.</param>
11700 /// <param name="seed">The initial accumulator value.</param>
11701 /// <param name="accumulator">An accumulator function to be invoked on each element.</param>
11702 /// <returns>An observable sequence containing the accumulated values.</returns>
11703 /// <exception cref="T:System.ArgumentNullException">
11704 /// <paramref name="source" /> or <paramref name="accumulator" /> is null.</exception>
11705 public static IQbservable<TAccumulate> Scan<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
11706 {
11707 if (source == null)
11708 throw new ArgumentNullException("source");
11709 if (accumulator == null)
11710 throw new ArgumentNullException("accumulator");
11711
11712 return source.Provider.CreateQuery<TAccumulate>(
11713 Expression.Call(
11714 null,
11715 #if CRIPPLED_REFLECTION
11716 InfoOf(() => Qbservable.Scan<TSource, TAccumulate>(default(IQbservable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))),
11717 #else
11718 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)),
11719 #endif
11720 source.Expression,
11721 Expression.Constant(seed, typeof(TAccumulate)),
11722 accumulator
11723 )
11724 );
11725 }
11726
11727 /// <summary>
11728 /// Projects each element of an observable sequence into a new form.
11729 /// </summary>
11730 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11731 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
11732 /// <param name="source">A sequence of elements to invoke a transform function on.</param>
11733 /// <param name="selector">A transform function to apply to each source element.</param>
11734 /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
11735 /// <exception cref="T:System.ArgumentNullException">
11736 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11737 public static IQbservable<TResult> Select<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, TResult>> selector)
11738 {
11739 if (source == null)
11740 throw new ArgumentNullException("source");
11741 if (selector == null)
11742 throw new ArgumentNullException("selector");
11743
11744 return source.Provider.CreateQuery<TResult>(
11745 Expression.Call(
11746 null,
11747 #if CRIPPLED_REFLECTION
11748 InfoOf(() => Qbservable.Select<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, TResult>>))),
11749 #else
11750 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11751 #endif
11752 source.Expression,
11753 selector
11754 )
11755 );
11756 }
11757
11758 /// <summary>
11759 /// Projects each element of an observable sequence into a new form by incorporating the element's index.
11760 /// </summary>
11761 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11762 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by running the selector function for each element in the source sequence.</typeparam>
11763 /// <param name="source">A sequence of elements to invoke a transform function on.</param>
11764 /// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
11765 /// <returns>An observable sequence whose elements are the result of invoking the transform function on each element of source.</returns>
11766 /// <exception cref="T:System.ArgumentNullException">
11767 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
11768 public static IQbservable<TResult> Select<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
11769 {
11770 if (source == null)
11771 throw new ArgumentNullException("source");
11772 if (selector == null)
11773 throw new ArgumentNullException("selector");
11774
11775 return source.Provider.CreateQuery<TResult>(
11776 Expression.Call(
11777 null,
11778 #if CRIPPLED_REFLECTION
11779 InfoOf(() => Qbservable.Select<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, TResult>>))),
11780 #else
11781 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11782 #endif
11783 source.Expression,
11784 selector
11785 )
11786 );
11787 }
11788
11789 /// <summary>
11790 /// Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
11791 /// </summary>
11792 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11793 /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
11794 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
11795 /// <param name="source">An observable sequence of elements to project.</param>
11796 /// <param name="collectionSelector">A transform function to apply to each element.</param>
11797 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
11798 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
11799 /// <exception cref="T:System.ArgumentNullException">
11800 /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
11801 /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
11802 public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
11803 {
11804 if (source == null)
11805 throw new ArgumentNullException("source");
11806 if (collectionSelector == null)
11807 throw new ArgumentNullException("collectionSelector");
11808 if (resultSelector == null)
11809 throw new ArgumentNullException("resultSelector");
11810
11811 return source.Provider.CreateQuery<TResult>(
11812 Expression.Call(
11813 null,
11814 #if CRIPPLED_REFLECTION
11815 InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))),
11816 #else
11817 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
11818 #endif
11819 source.Expression,
11820 collectionSelector,
11821 resultSelector
11822 )
11823 );
11824 }
11825
11826 /// <summary>
11827 /// Projects each element of an observable sequence to an enumerable sequence by incorporating the element's index, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
11828 /// </summary>
11829 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11830 /// <typeparam name="TCollection">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
11831 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
11832 /// <param name="source">An observable sequence of elements to project.</param>
11833 /// <param name="collectionSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
11834 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element and the fourth parameter represents the index of the intermediate element.</param>
11835 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
11836 /// <exception cref="T:System.ArgumentNullException">
11837 /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
11838 /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
11839 public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, int, TCollection, int, TResult>> resultSelector)
11840 {
11841 if (source == null)
11842 throw new ArgumentNullException("source");
11843 if (collectionSelector == null)
11844 throw new ArgumentNullException("collectionSelector");
11845 if (resultSelector == null)
11846 throw new ArgumentNullException("resultSelector");
11847
11848 return source.Provider.CreateQuery<TResult>(
11849 Expression.Call(
11850 null,
11851 #if CRIPPLED_REFLECTION
11852 InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IEnumerable<TCollection>>>), default(Expression<Func<TSource, int, TCollection, int, TResult>>))),
11853 #else
11854 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
11855 #endif
11856 source.Expression,
11857 collectionSelector,
11858 resultSelector
11859 )
11860 );
11861 }
11862
11863 /// <summary>
11864 /// Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
11865 /// </summary>
11866 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11867 /// <typeparam name="TCollection">The type of the elements in the projected intermediate sequences.</typeparam>
11868 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
11869 /// <param name="source">An observable sequence of elements to project.</param>
11870 /// <param name="collectionSelector">A transform function to apply to each element.</param>
11871 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
11872 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
11873 /// <exception cref="T:System.ArgumentNullException">
11874 /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
11875 public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
11876 {
11877 if (source == null)
11878 throw new ArgumentNullException("source");
11879 if (collectionSelector == null)
11880 throw new ArgumentNullException("collectionSelector");
11881 if (resultSelector == null)
11882 throw new ArgumentNullException("resultSelector");
11883
11884 return source.Provider.CreateQuery<TResult>(
11885 Expression.Call(
11886 null,
11887 #if CRIPPLED_REFLECTION
11888 InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))),
11889 #else
11890 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
11891 #endif
11892 source.Expression,
11893 collectionSelector,
11894 resultSelector
11895 )
11896 );
11897 }
11898
11899 /// <summary>
11900 /// Projects each element of an observable sequence to an observable sequence by incorporating the element's index, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
11901 /// </summary>
11902 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11903 /// <typeparam name="TCollection">The type of the elements in the projected intermediate sequences.</typeparam>
11904 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.</typeparam>
11905 /// <param name="source">An observable sequence of elements to project.</param>
11906 /// <param name="collectionSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
11907 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element and the fourth parameter represents the index of the intermediate element.</param>
11908 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
11909 /// <exception cref="T:System.ArgumentNullException">
11910 /// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
11911 public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IObservable<TCollection>>> collectionSelector, Expression<Func<TSource, int, TCollection, int, TResult>> resultSelector)
11912 {
11913 if (source == null)
11914 throw new ArgumentNullException("source");
11915 if (collectionSelector == null)
11916 throw new ArgumentNullException("collectionSelector");
11917 if (resultSelector == null)
11918 throw new ArgumentNullException("resultSelector");
11919
11920 return source.Provider.CreateQuery<TResult>(
11921 Expression.Call(
11922 null,
11923 #if CRIPPLED_REFLECTION
11924 InfoOf(() => Qbservable.SelectMany<TSource, TCollection, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IObservable<TCollection>>>), default(Expression<Func<TSource, int, TCollection, int, TResult>>))),
11925 #else
11926 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)),
11927 #endif
11928 source.Expression,
11929 collectionSelector,
11930 resultSelector
11931 )
11932 );
11933 }
11934
11935 /// <summary>
11936 /// Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
11937 /// </summary>
11938 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11939 /// <typeparam name="TOther">The type of the elements in the other sequence and the elements in the result sequence.</typeparam>
11940 /// <param name="source">An observable sequence of elements to project.</param>
11941 /// <param name="other">An observable sequence to project each element from the source sequence onto.</param>
11942 /// <returns>An observable sequence whose elements are the result of projecting each source element onto the other sequence and merging all the resulting sequences together.</returns>
11943 /// <exception cref="T:System.ArgumentNullException">
11944 /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
11945 public static IQbservable<TOther> SelectMany<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
11946 {
11947 if (source == null)
11948 throw new ArgumentNullException("source");
11949 if (other == null)
11950 throw new ArgumentNullException("other");
11951
11952 return source.Provider.CreateQuery<TOther>(
11953 Expression.Call(
11954 null,
11955 #if CRIPPLED_REFLECTION
11956 InfoOf(() => Qbservable.SelectMany<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
11957 #else
11958 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
11959 #endif
11960 source.Expression,
11961 GetSourceExpression(other)
11962 )
11963 );
11964 }
11965
11966 /// <summary>
11967 /// Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
11968 /// </summary>
11969 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
11970 /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
11971 /// <param name="source">An observable sequence of notifications to project.</param>
11972 /// <param name="onNext">A transform function to apply to each element.</param>
11973 /// <param name="onError">A transform function to apply when an error occurs in the source sequence.</param>
11974 /// <param name="onCompleted">A transform function to apply when the end of the source sequence is reached.</param>
11975 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.</returns>
11976 /// <exception cref="T:System.ArgumentNullException">
11977 /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> or <paramref name="onCompleted" /> is null.</exception>
11978 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> onNext, Expression<Func<Exception, IObservable<TResult>>> onError, Expression<Func<IObservable<TResult>>> onCompleted)
11979 {
11980 if (source == null)
11981 throw new ArgumentNullException("source");
11982 if (onNext == null)
11983 throw new ArgumentNullException("onNext");
11984 if (onError == null)
11985 throw new ArgumentNullException("onError");
11986 if (onCompleted == null)
11987 throw new ArgumentNullException("onCompleted");
11988
11989 return source.Provider.CreateQuery<TResult>(
11990 Expression.Call(
11991 null,
11992 #if CRIPPLED_REFLECTION
11993 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>), default(Expression<Func<Exception, IObservable<TResult>>>), default(Expression<Func<IObservable<TResult>>>))),
11994 #else
11995 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
11996 #endif
11997 source.Expression,
11998 onNext,
11999 onError,
12000 onCompleted
12001 )
12002 );
12003 }
12004
12005 /// <summary>
12006 /// Projects each notification of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence.
12007 /// </summary>
12008 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12009 /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
12010 /// <param name="source">An observable sequence of notifications to project.</param>
12011 /// <param name="onNext">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12012 /// <param name="onError">A transform function to apply when an error occurs in the source sequence.</param>
12013 /// <param name="onCompleted">A transform function to apply when the end of the source sequence is reached.</param>
12014 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.</returns>
12015 /// <exception cref="T:System.ArgumentNullException">
12016 /// <paramref name="source" /> or <paramref name="onNext" /> or <paramref name="onError" /> or <paramref name="onCompleted" /> is null.</exception>
12017 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IObservable<TResult>>> onNext, Expression<Func<Exception, IObservable<TResult>>> onError, Expression<Func<IObservable<TResult>>> onCompleted)
12018 {
12019 if (source == null)
12020 throw new ArgumentNullException("source");
12021 if (onNext == null)
12022 throw new ArgumentNullException("onNext");
12023 if (onError == null)
12024 throw new ArgumentNullException("onError");
12025 if (onCompleted == null)
12026 throw new ArgumentNullException("onCompleted");
12027
12028 return source.Provider.CreateQuery<TResult>(
12029 Expression.Call(
12030 null,
12031 #if CRIPPLED_REFLECTION
12032 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IObservable<TResult>>>), default(Expression<Func<Exception, IObservable<TResult>>>), default(Expression<Func<IObservable<TResult>>>))),
12033 #else
12034 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12035 #endif
12036 source.Expression,
12037 onNext,
12038 onError,
12039 onCompleted
12040 )
12041 );
12042 }
12043
12044 /// <summary>
12045 /// Projects each element of an observable sequence to an enumerable sequence and concatenates the resulting enumerable sequences into one observable sequence.
12046 /// </summary>
12047 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12048 /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam>
12049 /// <param name="source">An observable sequence of elements to project.</param>
12050 /// <param name="selector">A transform function to apply to each element.</param>
12051 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
12052 /// <exception cref="T:System.ArgumentNullException">
12053 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12054 /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
12055 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> selector)
12056 {
12057 if (source == null)
12058 throw new ArgumentNullException("source");
12059 if (selector == null)
12060 throw new ArgumentNullException("selector");
12061
12062 return source.Provider.CreateQuery<TResult>(
12063 Expression.Call(
12064 null,
12065 #if CRIPPLED_REFLECTION
12066 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IEnumerable<TResult>>>))),
12067 #else
12068 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12069 #endif
12070 source.Expression,
12071 selector
12072 )
12073 );
12074 }
12075
12076 /// <summary>
12077 /// Projects each element of an observable sequence to an enumerable sequence by incorporating the element's index and concatenates the resulting enumerable sequences into one observable sequence.
12078 /// </summary>
12079 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12080 /// <typeparam name="TResult">The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.</typeparam>
12081 /// <param name="source">An observable sequence of elements to project.</param>
12082 /// <param name="selector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12083 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
12084 /// <exception cref="T:System.ArgumentNullException">
12085 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12086 /// <remarks>The projected sequences are enumerated synchonously within the OnNext call of the source sequence. In order to do a concurrent, non-blocking merge, change the selector to return an observable sequence obtained using the <see cref="M:System.Reactive.Linq.Observable.ToObservable``1(System.Collections.Generic.IEnumerable{``0})" /> conversion.</remarks>
12087 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IEnumerable<TResult>>> selector)
12088 {
12089 if (source == null)
12090 throw new ArgumentNullException("source");
12091 if (selector == null)
12092 throw new ArgumentNullException("selector");
12093
12094 return source.Provider.CreateQuery<TResult>(
12095 Expression.Call(
12096 null,
12097 #if CRIPPLED_REFLECTION
12098 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IEnumerable<TResult>>>))),
12099 #else
12100 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12101 #endif
12102 source.Expression,
12103 selector
12104 )
12105 );
12106 }
12107
12108 /// <summary>
12109 /// Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
12110 /// </summary>
12111 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12112 /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
12113 /// <param name="source">An observable sequence of elements to project.</param>
12114 /// <param name="selector">A transform function to apply to each element.</param>
12115 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
12116 /// <exception cref="T:System.ArgumentNullException">
12117 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12118 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TResult>>> selector)
12119 {
12120 if (source == null)
12121 throw new ArgumentNullException("source");
12122 if (selector == null)
12123 throw new ArgumentNullException("selector");
12124
12125 return source.Provider.CreateQuery<TResult>(
12126 Expression.Call(
12127 null,
12128 #if CRIPPLED_REFLECTION
12129 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TResult>>>))),
12130 #else
12131 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12132 #endif
12133 source.Expression,
12134 selector
12135 )
12136 );
12137 }
12138
12139 /// <summary>
12140 /// Projects each element of an observable sequence to an observable sequence by incorporating the element's index and merges the resulting observable sequences into one observable sequence.
12141 /// </summary>
12142 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12143 /// <typeparam name="TResult">The type of the elements in the projected inner sequences and the elements in the merged result sequence.</typeparam>
12144 /// <param name="source">An observable sequence of elements to project.</param>
12145 /// <param name="selector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12146 /// <returns>An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
12147 /// <exception cref="T:System.ArgumentNullException">
12148 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12149 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, IObservable<TResult>>> selector)
12150 {
12151 if (source == null)
12152 throw new ArgumentNullException("source");
12153 if (selector == null)
12154 throw new ArgumentNullException("selector");
12155
12156 return source.Provider.CreateQuery<TResult>(
12157 Expression.Call(
12158 null,
12159 #if CRIPPLED_REFLECTION
12160 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, IObservable<TResult>>>))),
12161 #else
12162 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12163 #endif
12164 source.Expression,
12165 selector
12166 )
12167 );
12168 }
12169
12170 #if !NO_TPL
12171 /// <summary>
12172 /// Projects each element of an observable sequence to a task and merges all of the task results into one observable sequence.
12173 /// </summary>
12174 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12175 /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
12176 /// <param name="source">An observable sequence of elements to project.</param>
12177 /// <param name="selector">A transform function to apply to each element.</param>
12178 /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
12179 /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12180 /// <exception cref="T:System.ArgumentNullException">
12181 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12182 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
12183 {
12184 if (source == null)
12185 throw new ArgumentNullException("source");
12186 if (selector == null)
12187 throw new ArgumentNullException("selector");
12188
12189 return source.Provider.CreateQuery<TResult>(
12190 Expression.Call(
12191 null,
12192 #if CRIPPLED_REFLECTION
12193 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))),
12194 #else
12195 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12196 #endif
12197 source.Expression,
12198 selector
12199 )
12200 );
12201 }
12202 #endif
12203
12204 #if !NO_TPL
12205 /// <summary>
12206 /// Projects each element of an observable sequence to a task by incorporating the element's index and merges all of the task results into one observable sequence.
12207 /// </summary>
12208 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12209 /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
12210 /// <param name="source">An observable sequence of elements to project.</param>
12211 /// <param name="selector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12212 /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
12213 /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12214 /// <exception cref="T:System.ArgumentNullException">
12215 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12216 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, Task<TResult>>> selector)
12217 {
12218 if (source == null)
12219 throw new ArgumentNullException("source");
12220 if (selector == null)
12221 throw new ArgumentNullException("selector");
12222
12223 return source.Provider.CreateQuery<TResult>(
12224 Expression.Call(
12225 null,
12226 #if CRIPPLED_REFLECTION
12227 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, Task<TResult>>>))),
12228 #else
12229 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12230 #endif
12231 source.Expression,
12232 selector
12233 )
12234 );
12235 }
12236 #endif
12237
12238 #if !NO_TPL
12239 /// <summary>
12240 /// Projects each element of an observable sequence to a task with cancellation support and merges all of the task results into one observable sequence.
12241 /// </summary>
12242 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12243 /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
12244 /// <param name="source">An observable sequence of elements to project.</param>
12245 /// <param name="selector">A transform function to apply to each element.</param>
12246 /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
12247 /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12248 /// <exception cref="T:System.ArgumentNullException">
12249 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12250 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, CancellationToken, Task<TResult>>> selector)
12251 {
12252 if (source == null)
12253 throw new ArgumentNullException("source");
12254 if (selector == null)
12255 throw new ArgumentNullException("selector");
12256
12257 return source.Provider.CreateQuery<TResult>(
12258 Expression.Call(
12259 null,
12260 #if CRIPPLED_REFLECTION
12261 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, CancellationToken, Task<TResult>>>))),
12262 #else
12263 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12264 #endif
12265 source.Expression,
12266 selector
12267 )
12268 );
12269 }
12270 #endif
12271
12272 #if !NO_TPL
12273 /// <summary>
12274 /// Projects each element of an observable sequence to a task by incorporating the element's index with cancellation support and merges all of the task results into one observable sequence.
12275 /// </summary>
12276 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12277 /// <typeparam name="TResult">The type of the result produced by the projected tasks and the elements in the merged result sequence.</typeparam>
12278 /// <param name="source">An observable sequence of elements to project.</param>
12279 /// <param name="selector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12280 /// <returns>An observable sequence whose elements are the result of the tasks executed for each element of the input sequence.</returns>
12281 /// <remarks>This overload supports composition of observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12282 /// <exception cref="T:System.ArgumentNullException">
12283 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
12284 public static IQbservable<TResult> SelectMany<TSource, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, CancellationToken, Task<TResult>>> selector)
12285 {
12286 if (source == null)
12287 throw new ArgumentNullException("source");
12288 if (selector == null)
12289 throw new ArgumentNullException("selector");
12290
12291 return source.Provider.CreateQuery<TResult>(
12292 Expression.Call(
12293 null,
12294 #if CRIPPLED_REFLECTION
12295 InfoOf(() => Qbservable.SelectMany<TSource, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, CancellationToken, Task<TResult>>>))),
12296 #else
12297 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
12298 #endif
12299 source.Expression,
12300 selector
12301 )
12302 );
12303 }
12304 #endif
12305
12306 #if !NO_TPL
12307 /// <summary>
12308 /// Projects each element of an observable sequence to a task with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
12309 /// </summary>
12310 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12311 /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
12312 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
12313 /// <param name="source">An observable sequence of elements to project.</param>
12314 /// <param name="taskSelector">A transform function to apply to each element.</param>
12315 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
12316 /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
12317 /// <exception cref="T:System.ArgumentNullException">
12318 /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
12319 /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12320 public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, CancellationToken, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, TTaskResult, TResult>> resultSelector)
12321 {
12322 if (source == null)
12323 throw new ArgumentNullException("source");
12324 if (taskSelector == null)
12325 throw new ArgumentNullException("taskSelector");
12326 if (resultSelector == null)
12327 throw new ArgumentNullException("resultSelector");
12328
12329 return source.Provider.CreateQuery<TResult>(
12330 Expression.Call(
12331 null,
12332 #if CRIPPLED_REFLECTION
12333 InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, CancellationToken, Task<TTaskResult>>>), default(Expression<Func<TSource, TTaskResult, TResult>>))),
12334 #else
12335 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
12336 #endif
12337 source.Expression,
12338 taskSelector,
12339 resultSelector
12340 )
12341 );
12342 }
12343 #endif
12344
12345 #if !NO_TPL
12346 /// <summary>
12347 /// Projects each element of an observable sequence to a task by incorporating the element's index with cancellation support, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
12348 /// </summary>
12349 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12350 /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
12351 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
12352 /// <param name="source">An observable sequence of elements to project.</param>
12353 /// <param name="taskSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12354 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element.</param>
12355 /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
12356 /// <exception cref="T:System.ArgumentNullException">
12357 /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
12358 /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12359 public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, CancellationToken, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, int, TTaskResult, TResult>> resultSelector)
12360 {
12361 if (source == null)
12362 throw new ArgumentNullException("source");
12363 if (taskSelector == null)
12364 throw new ArgumentNullException("taskSelector");
12365 if (resultSelector == null)
12366 throw new ArgumentNullException("resultSelector");
12367
12368 return source.Provider.CreateQuery<TResult>(
12369 Expression.Call(
12370 null,
12371 #if CRIPPLED_REFLECTION
12372 InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, CancellationToken, Task<TTaskResult>>>), default(Expression<Func<TSource, int, TTaskResult, TResult>>))),
12373 #else
12374 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
12375 #endif
12376 source.Expression,
12377 taskSelector,
12378 resultSelector
12379 )
12380 );
12381 }
12382 #endif
12383
12384 #if !NO_TPL
12385 /// <summary>
12386 /// Projects each element of an observable sequence to a task, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
12387 /// </summary>
12388 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12389 /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
12390 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
12391 /// <param name="source">An observable sequence of elements to project.</param>
12392 /// <param name="taskSelector">A transform function to apply to each element.</param>
12393 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
12394 /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
12395 /// <exception cref="T:System.ArgumentNullException">
12396 /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
12397 /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12398 public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, TTaskResult, TResult>> resultSelector)
12399 {
12400 if (source == null)
12401 throw new ArgumentNullException("source");
12402 if (taskSelector == null)
12403 throw new ArgumentNullException("taskSelector");
12404 if (resultSelector == null)
12405 throw new ArgumentNullException("resultSelector");
12406
12407 return source.Provider.CreateQuery<TResult>(
12408 Expression.Call(
12409 null,
12410 #if CRIPPLED_REFLECTION
12411 InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, Task<TTaskResult>>>), default(Expression<Func<TSource, TTaskResult, TResult>>))),
12412 #else
12413 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
12414 #endif
12415 source.Expression,
12416 taskSelector,
12417 resultSelector
12418 )
12419 );
12420 }
12421 #endif
12422
12423 #if !NO_TPL
12424 /// <summary>
12425 /// Projects each element of an observable sequence to a task by incorporating the element's index, invokes the result selector for the source element and the task result, and merges the results into one observable sequence.
12426 /// </summary>
12427 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12428 /// <typeparam name="TTaskResult">The type of the results produced by the projected intermediate tasks.</typeparam>
12429 /// <typeparam name="TResult">The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate task results.</typeparam>
12430 /// <param name="source">An observable sequence of elements to project.</param>
12431 /// <param name="taskSelector">A transform function to apply to each element; the second parameter of the function represents the index of the source element.</param>
12432 /// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element.</param>
12433 /// <returns>An observable sequence whose elements are the result of obtaining a task for each element of the input sequence and then mapping the task's result and its corresponding source element to a result element.</returns>
12434 /// <exception cref="T:System.ArgumentNullException">
12435 /// <paramref name="source" /> or <paramref name="taskSelector" /> or <paramref name="resultSelector" /> is null.</exception>
12436 /// <remarks>This overload supports using LINQ query comprehension syntax in C# and Visual Basic to compose observable sequences and tasks, without requiring manual conversion of the tasks to observable sequences using <see cref="M:System.Reactive.Threading.Tasks.TaskObservableExtensions.ToObservable``1(System.Threading.Tasks.Task{``0})" />.</remarks>
12437 public static IQbservable<TResult> SelectMany<TSource, TTaskResult, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, int, Task<TTaskResult>>> taskSelector, Expression<Func<TSource, int, TTaskResult, TResult>> resultSelector)
12438 {
12439 if (source == null)
12440 throw new ArgumentNullException("source");
12441 if (taskSelector == null)
12442 throw new ArgumentNullException("taskSelector");
12443 if (resultSelector == null)
12444 throw new ArgumentNullException("resultSelector");
12445
12446 return source.Provider.CreateQuery<TResult>(
12447 Expression.Call(
12448 null,
12449 #if CRIPPLED_REFLECTION
12450 InfoOf(() => Qbservable.SelectMany<TSource, TTaskResult, TResult>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, Task<TTaskResult>>>), default(Expression<Func<TSource, int, TTaskResult, TResult>>))),
12451 #else
12452 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTaskResult), typeof(TResult)),
12453 #endif
12454 source.Expression,
12455 taskSelector,
12456 resultSelector
12457 )
12458 );
12459 }
12460 #endif
12461
12462 /// <summary>
12463 /// Determines whether two sequences are equal by comparing the elements pairwise.
12464 /// </summary>
12465 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12466 /// <param name="first">First observable sequence to compare.</param>
12467 /// <param name="second">Second observable sequence to compare.</param>
12468 /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
12469 /// <exception cref="T:System.ArgumentNullException">
12470 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
12471 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
12472 public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IObservable<TSource> second)
12473 {
12474 if (first == null)
12475 throw new ArgumentNullException("first");
12476 if (second == null)
12477 throw new ArgumentNullException("second");
12478
12479 return first.Provider.CreateQuery<bool>(
12480 Expression.Call(
12481 null,
12482 #if CRIPPLED_REFLECTION
12483 InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>))),
12484 #else
12485 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12486 #endif
12487 first.Expression,
12488 GetSourceExpression(second)
12489 )
12490 );
12491 }
12492
12493 /// <summary>
12494 /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise.
12495 /// </summary>
12496 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12497 /// <param name="first">First observable sequence to compare.</param>
12498 /// <param name="second">Second observable sequence to compare.</param>
12499 /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type.</returns>
12500 /// <exception cref="T:System.ArgumentNullException">
12501 /// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
12502 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
12503 public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IEnumerable<TSource> second)
12504 {
12505 if (first == null)
12506 throw new ArgumentNullException("first");
12507 if (second == null)
12508 throw new ArgumentNullException("second");
12509
12510 return first.Provider.CreateQuery<bool>(
12511 Expression.Call(
12512 null,
12513 #if CRIPPLED_REFLECTION
12514 InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IEnumerable<TSource>))),
12515 #else
12516 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12517 #endif
12518 first.Expression,
12519 GetSourceExpression(second)
12520 )
12521 );
12522 }
12523
12524 /// <summary>
12525 /// Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
12526 /// </summary>
12527 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12528 /// <param name="first">First observable sequence to compare.</param>
12529 /// <param name="second">Second observable sequence to compare.</param>
12530 /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
12531 /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
12532 /// <exception cref="T:System.ArgumentNullException">
12533 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="comparer" /> is null.</exception>
12534 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
12535 public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IObservable<TSource> second, IEqualityComparer<TSource> comparer)
12536 {
12537 if (first == null)
12538 throw new ArgumentNullException("first");
12539 if (second == null)
12540 throw new ArgumentNullException("second");
12541 if (comparer == null)
12542 throw new ArgumentNullException("comparer");
12543
12544 return first.Provider.CreateQuery<bool>(
12545 Expression.Call(
12546 null,
12547 #if CRIPPLED_REFLECTION
12548 InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IObservable<TSource>), default(IEqualityComparer<TSource>))),
12549 #else
12550 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12551 #endif
12552 first.Expression,
12553 GetSourceExpression(second),
12554 Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
12555 )
12556 );
12557 }
12558
12559 /// <summary>
12560 /// Determines whether an observable and enumerable sequence are equal by comparing the elements pairwise using a specified equality comparer.
12561 /// </summary>
12562 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12563 /// <param name="first">First observable sequence to compare.</param>
12564 /// <param name="second">Second observable sequence to compare.</param>
12565 /// <param name="comparer">Comparer used to compare elements of both sequences.</param>
12566 /// <returns>An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.</returns>
12567 /// <exception cref="T:System.ArgumentNullException">
12568 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="comparer" /> is null.</exception>
12569 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
12570 public static IQbservable<bool> SequenceEqual<TSource>(this IQbservable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
12571 {
12572 if (first == null)
12573 throw new ArgumentNullException("first");
12574 if (second == null)
12575 throw new ArgumentNullException("second");
12576 if (comparer == null)
12577 throw new ArgumentNullException("comparer");
12578
12579 return first.Provider.CreateQuery<bool>(
12580 Expression.Call(
12581 null,
12582 #if CRIPPLED_REFLECTION
12583 InfoOf(() => Qbservable.SequenceEqual<TSource>(default(IQbservable<TSource>), default(IEnumerable<TSource>), default(IEqualityComparer<TSource>))),
12584 #else
12585 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12586 #endif
12587 first.Expression,
12588 GetSourceExpression(second),
12589 Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))
12590 )
12591 );
12592 }
12593
12594 /// <summary>
12595 /// Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence.
12596 /// </summary>
12597 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12598 /// <param name="source">Source observable sequence.</param>
12599 /// <returns>Sequence containing the single element in the observable sequence.</returns>
12600 /// <exception cref="T:System.ArgumentNullException">
12601 /// <paramref name="source" /> is null.</exception>
12602 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence contains more than one element. -or- The source sequence is empty.</exception>
12603 public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source)
12604 {
12605 if (source == null)
12606 throw new ArgumentNullException("source");
12607
12608 return source.Provider.CreateQuery<TSource>(
12609 Expression.Call(
12610 null,
12611 #if CRIPPLED_REFLECTION
12612 InfoOf(() => Qbservable.SingleAsync<TSource>(default(IQbservable<TSource>))),
12613 #else
12614 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12615 #endif
12616 source.Expression
12617 )
12618 );
12619 }
12620
12621 /// <summary>
12622 /// Returns the only element of an observable sequence that satisfies the condition in the predicate, and reports an exception if there is not exactly one element in the observable sequence.
12623 /// </summary>
12624 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12625 /// <param name="source">Source observable sequence.</param>
12626 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
12627 /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.</returns>
12628 /// <exception cref="T:System.ArgumentNullException">
12629 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
12630 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty.</exception>
12631 public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
12632 {
12633 if (source == null)
12634 throw new ArgumentNullException("source");
12635 if (predicate == null)
12636 throw new ArgumentNullException("predicate");
12637
12638 return source.Provider.CreateQuery<TSource>(
12639 Expression.Call(
12640 null,
12641 #if CRIPPLED_REFLECTION
12642 InfoOf(() => Qbservable.SingleAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
12643 #else
12644 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12645 #endif
12646 source.Expression,
12647 predicate
12648 )
12649 );
12650 }
12651
12652 /// <summary>
12653 /// Returns the only element of an observable sequence, or a default value if the observable sequence is empty; this method reports an exception if there is more than one element in the observable sequence.
12654 /// </summary>
12655 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12656 /// <param name="source">Source observable sequence.</param>
12657 /// <returns>Sequence containing the single element in the observable sequence, or a default value if no such element exists.</returns>
12658 /// <exception cref="T:System.ArgumentNullException">
12659 /// <paramref name="source" /> is null.</exception>
12660 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The source sequence contains more than one element.</exception>
12661 public static IQbservable<TSource> SingleOrDefaultAsync<TSource>(this IQbservable<TSource> source)
12662 {
12663 if (source == null)
12664 throw new ArgumentNullException("source");
12665
12666 return source.Provider.CreateQuery<TSource>(
12667 Expression.Call(
12668 null,
12669 #if CRIPPLED_REFLECTION
12670 InfoOf(() => Qbservable.SingleOrDefaultAsync<TSource>(default(IQbservable<TSource>))),
12671 #else
12672 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12673 #endif
12674 source.Expression
12675 )
12676 );
12677 }
12678
12679 /// <summary>
12680 /// Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
12681 /// </summary>
12682 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12683 /// <param name="source">Source observable sequence.</param>
12684 /// <param name="predicate">A predicate function to evaluate for elements in the source sequence.</param>
12685 /// <returns>Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.</returns>
12686 /// <exception cref="T:System.ArgumentNullException">
12687 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
12688 /// <exception cref="T:System.InvalidOperationException">(Asynchronous) The sequence contains more than one element that satisfies the condition in the predicate.</exception>
12689 public static IQbservable<TSource> SingleOrDefaultAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
12690 {
12691 if (source == null)
12692 throw new ArgumentNullException("source");
12693 if (predicate == null)
12694 throw new ArgumentNullException("predicate");
12695
12696 return source.Provider.CreateQuery<TSource>(
12697 Expression.Call(
12698 null,
12699 #if CRIPPLED_REFLECTION
12700 InfoOf(() => Qbservable.SingleOrDefaultAsync<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
12701 #else
12702 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12703 #endif
12704 source.Expression,
12705 predicate
12706 )
12707 );
12708 }
12709
12710 /// <summary>
12711 /// Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
12712 /// </summary>
12713 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12714 /// <param name="source">The sequence to take elements from.</param>
12715 /// <param name="count">The number of elements to skip before returning the remaining elements.</param>
12716 /// <returns>An observable sequence that contains the elements that occur after the specified index in the input sequence.</returns>
12717 /// <exception cref="T:System.ArgumentNullException">
12718 /// <paramref name="source" /> is null.</exception>
12719 /// <exception cref="T:System.ArgumentOutOfRangeException">
12720 /// <paramref name="count" /> is less than zero.</exception>
12721 public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, int count)
12722 {
12723 if (source == null)
12724 throw new ArgumentNullException("source");
12725
12726 return source.Provider.CreateQuery<TSource>(
12727 Expression.Call(
12728 null,
12729 #if CRIPPLED_REFLECTION
12730 InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(int))),
12731 #else
12732 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12733 #endif
12734 source.Expression,
12735 Expression.Constant(count, typeof(int))
12736 )
12737 );
12738 }
12739
12740 /// <summary>
12741 /// Skips elements for the specified duration from the start of the observable source sequence.
12742 /// </summary>
12743 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12744 /// <param name="source">Source sequence to skip elements for.</param>
12745 /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
12746 /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
12747 /// <exception cref="T:System.ArgumentNullException">
12748 /// <paramref name="source" /> is null.</exception>
12749 /// <exception cref="T:System.ArgumentOutOfRangeException">
12750 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
12751 /// <remarks>
12752 /// <para>
12753 /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee no elements will be dropped from the start of the source sequence.
12754 /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
12755 /// may not execute immediately, despite the TimeSpan.Zero due time.
12756 /// </para>
12757 /// <para>
12758 /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration" />.
12759 /// </para>
12760 /// </remarks>
12761 public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, TimeSpan duration)
12762 {
12763 if (source == null)
12764 throw new ArgumentNullException("source");
12765
12766 return source.Provider.CreateQuery<TSource>(
12767 Expression.Call(
12768 null,
12769 #if CRIPPLED_REFLECTION
12770 InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
12771 #else
12772 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12773 #endif
12774 source.Expression,
12775 Expression.Constant(duration, typeof(TimeSpan))
12776 )
12777 );
12778 }
12779
12780 /// <summary>
12781 /// Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
12782 /// </summary>
12783 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12784 /// <param name="source">Source sequence to skip elements for.</param>
12785 /// <param name="duration">Duration for skipping elements from the start of the sequence.</param>
12786 /// <param name="scheduler">Scheduler to run the timer on.</param>
12787 /// <returns>An observable sequence with the elements skipped during the specified duration from the start of the source sequence.</returns>
12788 /// <exception cref="T:System.ArgumentNullException">
12789 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
12790 /// <exception cref="T:System.ArgumentOutOfRangeException">
12791 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
12792 /// <remarks>
12793 /// <para>
12794 /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee no elements will be dropped from the start of the source sequence.
12795 /// This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
12796 /// may not execute immediately, despite the TimeSpan.Zero due time.
12797 /// </para>
12798 /// <para>
12799 /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="duration" />.
12800 /// </para>
12801 /// </remarks>
12802 public static IQbservable<TSource> Skip<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
12803 {
12804 if (source == null)
12805 throw new ArgumentNullException("source");
12806 if (scheduler == null)
12807 throw new ArgumentNullException("scheduler");
12808
12809 return source.Provider.CreateQuery<TSource>(
12810 Expression.Call(
12811 null,
12812 #if CRIPPLED_REFLECTION
12813 InfoOf(() => Qbservable.Skip<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
12814 #else
12815 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12816 #endif
12817 source.Expression,
12818 Expression.Constant(duration, typeof(TimeSpan)),
12819 Expression.Constant(scheduler, typeof(IScheduler))
12820 )
12821 );
12822 }
12823
12824 /// <summary>
12825 /// Bypasses a specified number of elements at the end of an observable sequence.
12826 /// </summary>
12827 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12828 /// <param name="source">Source sequence.</param>
12829 /// <param name="count">Number of elements to bypass at the end of the source sequence.</param>
12830 /// <returns>An observable sequence containing the source sequence elements except for the bypassed ones at the end.</returns>
12831 /// <exception cref="T:System.ArgumentNullException">
12832 /// <paramref name="source" /> is null.</exception>
12833 /// <exception cref="T:System.ArgumentOutOfRangeException">
12834 /// <paramref name="count" /> is less than zero.</exception>
12835 /// <remarks>
12836 /// This operator accumulates a queue with a length enough to store the first <paramref name="count" /> elements. As more elements are
12837 /// received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
12838 /// </remarks>
12839 public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, int count)
12840 {
12841 if (source == null)
12842 throw new ArgumentNullException("source");
12843
12844 return source.Provider.CreateQuery<TSource>(
12845 Expression.Call(
12846 null,
12847 #if CRIPPLED_REFLECTION
12848 InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(int))),
12849 #else
12850 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12851 #endif
12852 source.Expression,
12853 Expression.Constant(count, typeof(int))
12854 )
12855 );
12856 }
12857
12858 /// <summary>
12859 /// Skips elements for the specified duration from the end of the observable source sequence.
12860 /// </summary>
12861 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12862 /// <param name="source">Source sequence to skip elements for.</param>
12863 /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
12864 /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
12865 /// <exception cref="T:System.ArgumentNullException">
12866 /// <paramref name="source" /> is null.</exception>
12867 /// <exception cref="T:System.ArgumentOutOfRangeException">
12868 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
12869 /// <remarks>
12870 /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration" /> window.
12871 /// As more elements are received, elements older than the specified <paramref name="duration" /> are taken from the queue and produced on the
12872 /// result sequence. This causes elements to be delayed with <paramref name="duration" />.
12873 /// </remarks>
12874 public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, TimeSpan duration)
12875 {
12876 if (source == null)
12877 throw new ArgumentNullException("source");
12878
12879 return source.Provider.CreateQuery<TSource>(
12880 Expression.Call(
12881 null,
12882 #if CRIPPLED_REFLECTION
12883 InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
12884 #else
12885 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12886 #endif
12887 source.Expression,
12888 Expression.Constant(duration, typeof(TimeSpan))
12889 )
12890 );
12891 }
12892
12893 /// <summary>
12894 /// Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
12895 /// </summary>
12896 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12897 /// <param name="source">Source sequence to skip elements for.</param>
12898 /// <param name="duration">Duration for skipping elements from the end of the sequence.</param>
12899 /// <param name="scheduler">Scheduler to run the timer on.</param>
12900 /// <returns>An observable sequence with the elements skipped during the specified duration from the end of the source sequence.</returns>
12901 /// <exception cref="T:System.ArgumentNullException">
12902 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
12903 /// <exception cref="T:System.ArgumentOutOfRangeException">
12904 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
12905 /// <remarks>
12906 /// This operator accumulates a queue with a length enough to store elements received during the initial <paramref name="duration" /> window.
12907 /// As more elements are received, elements older than the specified <paramref name="duration" /> are taken from the queue and produced on the
12908 /// result sequence. This causes elements to be delayed with <paramref name="duration" />.
12909 /// </remarks>
12910 public static IQbservable<TSource> SkipLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
12911 {
12912 if (source == null)
12913 throw new ArgumentNullException("source");
12914 if (scheduler == null)
12915 throw new ArgumentNullException("scheduler");
12916
12917 return source.Provider.CreateQuery<TSource>(
12918 Expression.Call(
12919 null,
12920 #if CRIPPLED_REFLECTION
12921 InfoOf(() => Qbservable.SkipLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
12922 #else
12923 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12924 #endif
12925 source.Expression,
12926 Expression.Constant(duration, typeof(TimeSpan)),
12927 Expression.Constant(scheduler, typeof(IScheduler))
12928 )
12929 );
12930 }
12931
12932 /// <summary>
12933 /// Skips elements from the observable source sequence until the specified start time.
12934 /// </summary>
12935 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12936 /// <param name="source">Source sequence to skip elements for.</param>
12937 /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
12938 /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
12939 /// <exception cref="T:System.ArgumentNullException">
12940 /// <paramref name="source" /> is null.</exception>
12941 /// <remarks>
12942 /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime" />.
12943 /// </remarks>
12944 public static IQbservable<TSource> SkipUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset startTime)
12945 {
12946 if (source == null)
12947 throw new ArgumentNullException("source");
12948
12949 return source.Provider.CreateQuery<TSource>(
12950 Expression.Call(
12951 null,
12952 #if CRIPPLED_REFLECTION
12953 InfoOf(() => Qbservable.SkipUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
12954 #else
12955 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12956 #endif
12957 source.Expression,
12958 Expression.Constant(startTime, typeof(DateTimeOffset))
12959 )
12960 );
12961 }
12962
12963 /// <summary>
12964 /// Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
12965 /// </summary>
12966 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
12967 /// <param name="source">Source sequence to skip elements for.</param>
12968 /// <param name="startTime">Time to start taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, no elements will be skipped.</param>
12969 /// <param name="scheduler">Scheduler to run the timer on.</param>
12970 /// <returns>An observable sequence with the elements skipped until the specified start time.</returns>
12971 /// <exception cref="T:System.ArgumentNullException">
12972 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
12973 /// <remarks>
12974 /// Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the <paramref name="startTime" />.
12975 /// </remarks>
12976 public static IQbservable<TSource> SkipUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset startTime, IScheduler scheduler)
12977 {
12978 if (source == null)
12979 throw new ArgumentNullException("source");
12980 if (scheduler == null)
12981 throw new ArgumentNullException("scheduler");
12982
12983 return source.Provider.CreateQuery<TSource>(
12984 Expression.Call(
12985 null,
12986 #if CRIPPLED_REFLECTION
12987 InfoOf(() => Qbservable.SkipUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
12988 #else
12989 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
12990 #endif
12991 source.Expression,
12992 Expression.Constant(startTime, typeof(DateTimeOffset)),
12993 Expression.Constant(scheduler, typeof(IScheduler))
12994 )
12995 );
12996 }
12997
12998 /// <summary>
12999 /// Returns the elements from the source observable sequence only after the other observable sequence produces an element.
13000 /// </summary>
13001 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13002 /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of skip behavior.</typeparam>
13003 /// <param name="source">Source sequence to propagate elements for.</param>
13004 /// <param name="other">Observable sequence that triggers propagation of elements of the source sequence.</param>
13005 /// <returns>An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.</returns>
13006 /// <exception cref="T:System.ArgumentNullException">
13007 /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
13008 public static IQbservable<TSource> SkipUntil<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
13009 {
13010 if (source == null)
13011 throw new ArgumentNullException("source");
13012 if (other == null)
13013 throw new ArgumentNullException("other");
13014
13015 return source.Provider.CreateQuery<TSource>(
13016 Expression.Call(
13017 null,
13018 #if CRIPPLED_REFLECTION
13019 InfoOf(() => Qbservable.SkipUntil<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
13020 #else
13021 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
13022 #endif
13023 source.Expression,
13024 GetSourceExpression(other)
13025 )
13026 );
13027 }
13028
13029 /// <summary>
13030 /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
13031 /// </summary>
13032 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13033 /// <param name="source">An observable sequence to return elements from.</param>
13034 /// <param name="predicate">A function to test each element for a condition.</param>
13035 /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
13036 /// <exception cref="T:System.ArgumentNullException">
13037 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
13038 public static IQbservable<TSource> SkipWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
13039 {
13040 if (source == null)
13041 throw new ArgumentNullException("source");
13042 if (predicate == null)
13043 throw new ArgumentNullException("predicate");
13044
13045 return source.Provider.CreateQuery<TSource>(
13046 Expression.Call(
13047 null,
13048 #if CRIPPLED_REFLECTION
13049 InfoOf(() => Qbservable.SkipWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
13050 #else
13051 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13052 #endif
13053 source.Expression,
13054 predicate
13055 )
13056 );
13057 }
13058
13059 /// <summary>
13060 /// Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
13061 /// The element's index is used in the logic of the predicate function.
13062 /// </summary>
13063 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13064 /// <param name="source">An observable sequence to return elements from.</param>
13065 /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
13066 /// <returns>An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.</returns>
13067 /// <exception cref="T:System.ArgumentNullException">
13068 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
13069 public static IQbservable<TSource> SkipWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
13070 {
13071 if (source == null)
13072 throw new ArgumentNullException("source");
13073 if (predicate == null)
13074 throw new ArgumentNullException("predicate");
13075
13076 return source.Provider.CreateQuery<TSource>(
13077 Expression.Call(
13078 null,
13079 #if CRIPPLED_REFLECTION
13080 InfoOf(() => Qbservable.SkipWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
13081 #else
13082 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13083 #endif
13084 source.Expression,
13085 predicate
13086 )
13087 );
13088 }
13089
13090 /// <summary>
13091 /// Invokes the action asynchronously, surfacing the result through an observable sequence.
13092 /// </summary>
13093 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13094 /// <param name="action">Action to run asynchronously.</param>
13095 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
13096 /// <exception cref="T:System.ArgumentNullException">
13097 /// <paramref name="action" /> is null.</exception>
13098 /// <remarks>
13099 /// <list type="bullet">
13100 /// <item>
13101 /// <description>The action is called immediately, not during the subscription of the resulting sequence.</description>
13102 /// </item>
13103 /// <item>
13104 /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
13105 /// </item>
13106 /// </list>
13107 /// </remarks>
13108 public static IQbservable<Unit> Start(this IQbservableProvider provider, Expression<Action> action)
13109 {
13110 if (provider == null)
13111 throw new ArgumentNullException("provider");
13112 if (action == null)
13113 throw new ArgumentNullException("action");
13114
13115 return provider.CreateQuery<Unit>(
13116 Expression.Call(
13117 null,
13118 #if CRIPPLED_REFLECTION
13119 InfoOf(() => Qbservable.Start(default(IQbservableProvider), default(Expression<Action>))),
13120 #else
13121 (MethodInfo)MethodInfo.GetCurrentMethod(),
13122 #endif
13123 Expression.Constant(provider, typeof(IQbservableProvider)),
13124 action
13125 )
13126 );
13127 }
13128
13129 /// <summary>
13130 /// Invokes the action asynchronously on the specified scheduler, surfacing the result through an observable sequence.
13131 /// </summary>
13132 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13133 /// <param name="action">Action to run asynchronously.</param>
13134 /// <param name="scheduler">Scheduler to run the action on.</param>
13135 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
13136 /// <exception cref="T:System.ArgumentNullException">
13137 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
13138 /// <remarks>
13139 /// <list type="bullet">
13140 /// <item>
13141 /// <description>The action is called immediately, not during the subscription of the resulting sequence.</description>
13142 /// </item>
13143 /// <item>
13144 /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
13145 /// </item>
13146 /// </list>
13147 /// </remarks>
13148 public static IQbservable<Unit> Start(this IQbservableProvider provider, Expression<Action> action, IScheduler scheduler)
13149 {
13150 if (provider == null)
13151 throw new ArgumentNullException("provider");
13152 if (action == null)
13153 throw new ArgumentNullException("action");
13154 if (scheduler == null)
13155 throw new ArgumentNullException("scheduler");
13156
13157 return provider.CreateQuery<Unit>(
13158 Expression.Call(
13159 null,
13160 #if CRIPPLED_REFLECTION
13161 InfoOf(() => Qbservable.Start(default(IQbservableProvider), default(Expression<Action>), default(IScheduler))),
13162 #else
13163 (MethodInfo)MethodInfo.GetCurrentMethod(),
13164 #endif
13165 Expression.Constant(provider, typeof(IQbservableProvider)),
13166 action,
13167 Expression.Constant(scheduler, typeof(IScheduler))
13168 )
13169 );
13170 }
13171
13172 /// <summary>
13173 /// Invokes the specified function asynchronously, surfacing the result through an observable sequence.
13174 /// </summary>
13175 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13176 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
13177 /// <param name="function">Function to run asynchronously.</param>
13178 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
13179 /// <exception cref="T:System.ArgumentNullException">
13180 /// <paramref name="function" /> is null.</exception>
13181 /// <remarks>
13182 /// <list type="bullet">
13183 /// <item>
13184 /// <description>The function is called immediately, not during the subscription of the resulting sequence.</description>
13185 /// </item>
13186 /// <item>
13187 /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
13188 /// </item>
13189 /// </list>
13190 /// </remarks>
13191 public static IQbservable<TResult> Start<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function)
13192 {
13193 if (provider == null)
13194 throw new ArgumentNullException("provider");
13195 if (function == null)
13196 throw new ArgumentNullException("function");
13197
13198 return provider.CreateQuery<TResult>(
13199 Expression.Call(
13200 null,
13201 #if CRIPPLED_REFLECTION
13202 InfoOf(() => Qbservable.Start<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>))),
13203 #else
13204 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
13205 #endif
13206 Expression.Constant(provider, typeof(IQbservableProvider)),
13207 function
13208 )
13209 );
13210 }
13211
13212 /// <summary>
13213 /// Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence
13214 /// </summary>
13215 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13216 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
13217 /// <param name="function">Function to run asynchronously.</param>
13218 /// <param name="scheduler">Scheduler to run the function on.</param>
13219 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
13220 /// <exception cref="T:System.ArgumentNullException">
13221 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
13222 /// <remarks>
13223 /// <list type="bullet">
13224 /// <item>
13225 /// <description>The function is called immediately, not during the subscription of the resulting sequence.</description>
13226 /// </item>
13227 /// <item>
13228 /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
13229 /// </item>
13230 /// </list>
13231 /// </remarks>
13232 public static IQbservable<TResult> Start<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function, IScheduler scheduler)
13233 {
13234 if (provider == null)
13235 throw new ArgumentNullException("provider");
13236 if (function == null)
13237 throw new ArgumentNullException("function");
13238 if (scheduler == null)
13239 throw new ArgumentNullException("scheduler");
13240
13241 return provider.CreateQuery<TResult>(
13242 Expression.Call(
13243 null,
13244 #if CRIPPLED_REFLECTION
13245 InfoOf(() => Qbservable.Start<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>), default(IScheduler))),
13246 #else
13247 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
13248 #endif
13249 Expression.Constant(provider, typeof(IQbservableProvider)),
13250 function,
13251 Expression.Constant(scheduler, typeof(IScheduler))
13252 )
13253 );
13254 }
13255
13256 #if !NO_TPL
13257 /// <summary>
13258 /// Invokes the asynchronous action, surfacing the result through an observable sequence.
13259 /// </summary>
13260 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13261 /// <param name="actionAsync">Asynchronous action to run.</param>
13262 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
13263 /// <exception cref="T:System.ArgumentNullException">
13264 /// <paramref name="actionAsync" /> is null.</exception>
13265 /// <remarks>
13266 /// <list type="bullet">
13267 /// <item>
13268 /// <description>The action is started immediately, not during the subscription of the resulting sequence.</description>
13269 /// </item>
13270 /// <item>
13271 /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
13272 /// </item>
13273 /// </list>
13274 /// </remarks>
13275 public static IQbservable<Unit> StartAsync(this IQbservableProvider provider, Expression<Func<Task>> actionAsync)
13276 {
13277 if (provider == null)
13278 throw new ArgumentNullException("provider");
13279 if (actionAsync == null)
13280 throw new ArgumentNullException("actionAsync");
13281
13282 return provider.CreateQuery<Unit>(
13283 Expression.Call(
13284 null,
13285 #if CRIPPLED_REFLECTION
13286 InfoOf(() => Qbservable.StartAsync(default(IQbservableProvider), default(Expression<Func<Task>>))),
13287 #else
13288 (MethodInfo)MethodInfo.GetCurrentMethod(),
13289 #endif
13290 Expression.Constant(provider, typeof(IQbservableProvider)),
13291 actionAsync
13292 )
13293 );
13294 }
13295 #endif
13296
13297 #if !NO_TPL
13298 /// <summary>
13299 /// Invokes the asynchronous action, surfacing the result through an observable sequence.
13300 /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
13301 /// </summary>
13302 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13303 /// <param name="actionAsync">Asynchronous action to run.</param>
13304 /// <returns>An observable sequence exposing a Unit value upon completion of the action, or an exception.</returns>
13305 /// <exception cref="T:System.ArgumentNullException">
13306 /// <paramref name="actionAsync" /> is null.</exception>
13307 /// <remarks>
13308 /// <list type="bullet">
13309 /// <item>
13310 /// <description>The action is started immediately, not during the subscription of the resulting sequence.</description>
13311 /// </item>
13312 /// <item>
13313 /// <description>Multiple subscriptions to the resulting sequence can observe the action's outcome.</description>
13314 /// </item>
13315 /// <item>
13316 /// <description>
13317 /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
13318 /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
13319 /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
13320 /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
13321 /// multicast operators.
13322 /// </description>
13323 /// </item>
13324 /// </list>
13325 /// </remarks>
13326 public static IQbservable<Unit> StartAsync(this IQbservableProvider provider, Expression<Func<CancellationToken, Task>> actionAsync)
13327 {
13328 if (provider == null)
13329 throw new ArgumentNullException("provider");
13330 if (actionAsync == null)
13331 throw new ArgumentNullException("actionAsync");
13332
13333 return provider.CreateQuery<Unit>(
13334 Expression.Call(
13335 null,
13336 #if CRIPPLED_REFLECTION
13337 InfoOf(() => Qbservable.StartAsync(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task>>))),
13338 #else
13339 (MethodInfo)MethodInfo.GetCurrentMethod(),
13340 #endif
13341 Expression.Constant(provider, typeof(IQbservableProvider)),
13342 actionAsync
13343 )
13344 );
13345 }
13346 #endif
13347
13348 #if !NO_TPL
13349 /// <summary>
13350 /// Invokes the asynchronous function, surfacing the result through an observable sequence.
13351 /// </summary>
13352 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13353 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
13354 /// <param name="functionAsync">Asynchronous function to run.</param>
13355 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
13356 /// <exception cref="T:System.ArgumentNullException">
13357 /// <paramref name="functionAsync" /> is null.</exception>
13358 /// <remarks>
13359 /// <list type="bullet">
13360 /// <item>
13361 /// <description>The function is started immediately, not during the subscription of the resulting sequence.</description>
13362 /// </item>
13363 /// <item>
13364 /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
13365 /// </item>
13366 /// </list>
13367 /// </remarks>
13368 public static IQbservable<TResult> StartAsync<TResult>(this IQbservableProvider provider, Expression<Func<Task<TResult>>> functionAsync)
13369 {
13370 if (provider == null)
13371 throw new ArgumentNullException("provider");
13372 if (functionAsync == null)
13373 throw new ArgumentNullException("functionAsync");
13374
13375 return provider.CreateQuery<TResult>(
13376 Expression.Call(
13377 null,
13378 #if CRIPPLED_REFLECTION
13379 InfoOf(() => Qbservable.StartAsync<TResult>(default(IQbservableProvider), default(Expression<Func<Task<TResult>>>))),
13380 #else
13381 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
13382 #endif
13383 Expression.Constant(provider, typeof(IQbservableProvider)),
13384 functionAsync
13385 )
13386 );
13387 }
13388 #endif
13389
13390 #if !NO_TPL
13391 /// <summary>
13392 /// Invokes the asynchronous function, surfacing the result through an observable sequence.
13393 /// The CancellationToken is shared by all subscriptions on the resulting observable sequence. See the remarks section for more information.
13394 /// </summary>
13395 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
13396 /// <typeparam name="TResult">The type of the result returned by the asynchronous function.</typeparam>
13397 /// <param name="functionAsync">Asynchronous function to run.</param>
13398 /// <returns>An observable sequence exposing the function's result value, or an exception.</returns>
13399 /// <exception cref="T:System.ArgumentNullException">
13400 /// <paramref name="functionAsync" /> is null.</exception>
13401 /// <remarks>
13402 /// <list type="bullet">
13403 /// <item>
13404 /// <description>The function is started immediately, not during the subscription of the resulting sequence.</description>
13405 /// </item>
13406 /// <item>
13407 /// <description>Multiple subscriptions to the resulting sequence can observe the function's result.</description>
13408 /// </item>
13409 /// <item>
13410 /// <description>
13411 /// If any subscription to the resulting sequence is disposed, the CancellationToken is set. The observer associated to the disposed
13412 /// subscription won't see the TaskCanceledException, but other observers will. You can protect against this using the Catch operator.
13413 /// Be careful when handing out the resulting sequence because of this behavior. The most common use is to have a single subscription
13414 /// to the resulting sequence, which controls the CancellationToken state. Alternatively, you can control subscription behavior using
13415 /// multicast operators.
13416 /// </description>
13417 /// </item>
13418 /// </list>
13419 /// </remarks>
13420 public static IQbservable<TResult> StartAsync<TResult>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResult>>> functionAsync)
13421 {
13422 if (provider == null)
13423 throw new ArgumentNullException("provider");
13424 if (functionAsync == null)
13425 throw new ArgumentNullException("functionAsync");
13426
13427 return provider.CreateQuery<TResult>(
13428 Expression.Call(
13429 null,
13430 #if CRIPPLED_REFLECTION
13431 InfoOf(() => Qbservable.StartAsync<TResult>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResult>>>))),
13432 #else
13433 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
13434 #endif
13435 Expression.Constant(provider, typeof(IQbservableProvider)),
13436 functionAsync
13437 )
13438 );
13439 }
13440 #endif
13441
13442 /// <summary>
13443 /// Prepends a sequence of values to an observable sequence.
13444 /// </summary>
13445 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13446 /// <param name="source">Source sequence to prepend values to.</param>
13447 /// <param name="scheduler">Scheduler to emit the prepended values on.</param>
13448 /// <param name="values">Values to prepend to the specified sequence.</param>
13449 /// <returns>The source sequence prepended with the specified values.</returns>
13450 /// <exception cref="T:System.ArgumentNullException">
13451 /// <paramref name="source" /> or <paramref name="scheduler" /> or <paramref name="values" /> is null.</exception>
13452 public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, IScheduler scheduler, params TSource[] values)
13453 {
13454 if (source == null)
13455 throw new ArgumentNullException("source");
13456 if (scheduler == null)
13457 throw new ArgumentNullException("scheduler");
13458 if (values == null)
13459 throw new ArgumentNullException("values");
13460
13461 return source.Provider.CreateQuery<TSource>(
13462 Expression.Call(
13463 null,
13464 #if CRIPPLED_REFLECTION
13465 InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(IScheduler), default(TSource[]))),
13466 #else
13467 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13468 #endif
13469 source.Expression,
13470 Expression.Constant(scheduler, typeof(IScheduler)),
13471 Expression.Constant(values, typeof(TSource[]))
13472 )
13473 );
13474 }
13475
13476 /// <summary>
13477 /// Prepends a sequence of values to an observable sequence.
13478 /// </summary>
13479 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13480 /// <param name="source">Source sequence to prepend values to.</param>
13481 /// <param name="scheduler">Scheduler to emit the prepended values on.</param>
13482 /// <param name="values">Values to prepend to the specified sequence.</param>
13483 /// <returns>The source sequence prepended with the specified values.</returns>
13484 /// <exception cref="T:System.ArgumentNullException">
13485 /// <paramref name="source" /> or <paramref name="scheduler" /> or <paramref name="values" /> is null.</exception>
13486 public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, IScheduler scheduler, IEnumerable<TSource> values)
13487 {
13488 if (source == null)
13489 throw new ArgumentNullException("source");
13490 if (scheduler == null)
13491 throw new ArgumentNullException("scheduler");
13492 if (values == null)
13493 throw new ArgumentNullException("values");
13494
13495 return source.Provider.CreateQuery<TSource>(
13496 Expression.Call(
13497 null,
13498 #if CRIPPLED_REFLECTION
13499 InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(IScheduler), default(IEnumerable<TSource>))),
13500 #else
13501 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13502 #endif
13503 source.Expression,
13504 Expression.Constant(scheduler, typeof(IScheduler)),
13505 GetSourceExpression(values)
13506 )
13507 );
13508 }
13509
13510 /// <summary>
13511 /// Prepends a sequence of values to an observable sequence.
13512 /// </summary>
13513 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13514 /// <param name="source">Source sequence to prepend values to.</param>
13515 /// <param name="values">Values to prepend to the specified sequence.</param>
13516 /// <returns>The source sequence prepended with the specified values.</returns>
13517 /// <exception cref="T:System.ArgumentNullException">
13518 /// <paramref name="source" /> or <paramref name="values" /> is null.</exception>
13519 public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, params TSource[] values)
13520 {
13521 if (source == null)
13522 throw new ArgumentNullException("source");
13523 if (values == null)
13524 throw new ArgumentNullException("values");
13525
13526 return source.Provider.CreateQuery<TSource>(
13527 Expression.Call(
13528 null,
13529 #if CRIPPLED_REFLECTION
13530 InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(TSource[]))),
13531 #else
13532 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13533 #endif
13534 source.Expression,
13535 Expression.Constant(values, typeof(TSource[]))
13536 )
13537 );
13538 }
13539
13540 /// <summary>
13541 /// Prepends a sequence of values to an observable sequence.
13542 /// </summary>
13543 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13544 /// <param name="source">Source sequence to prepend values to.</param>
13545 /// <param name="values">Values to prepend to the specified sequence.</param>
13546 /// <returns>The source sequence prepended with the specified values.</returns>
13547 /// <exception cref="T:System.ArgumentNullException">
13548 /// <paramref name="source" /> or <paramref name="values" /> is null.</exception>
13549 public static IQbservable<TSource> StartWith<TSource>(this IQbservable<TSource> source, IEnumerable<TSource> values)
13550 {
13551 if (source == null)
13552 throw new ArgumentNullException("source");
13553 if (values == null)
13554 throw new ArgumentNullException("values");
13555
13556 return source.Provider.CreateQuery<TSource>(
13557 Expression.Call(
13558 null,
13559 #if CRIPPLED_REFLECTION
13560 InfoOf(() => Qbservable.StartWith<TSource>(default(IQbservable<TSource>), default(IEnumerable<TSource>))),
13561 #else
13562 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13563 #endif
13564 source.Expression,
13565 GetSourceExpression(values)
13566 )
13567 );
13568 }
13569
13570 /// <summary>
13571 /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. This operation is not commonly used;
13572 /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
13573 /// </summary>
13574 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13575 /// <param name="source">Source sequence.</param>
13576 /// <param name="context">Synchronization context to perform subscription and unsubscription actions on.</param>
13577 /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified synchronization context.</returns>
13578 /// <exception cref="T:System.ArgumentNullException">
13579 /// <paramref name="source" /> or <paramref name="context" /> is null.</exception>
13580 /// <remarks>
13581 /// This only performs the side-effects of subscription and unsubscription on the specified synchronization context. In order to invoke observer
13582 /// callbacks on a synchronization context, use <see cref="M:System.Reactive.Linq.Observable.ObserveOn``1(System.IObservable{``0},System.Threading.SynchronizationContext)" />.
13583 /// </remarks>
13584 public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)
13585 {
13586 if (source == null)
13587 throw new ArgumentNullException("source");
13588 if (context == null)
13589 throw new ArgumentNullException("context");
13590
13591 return source.Provider.CreateQuery<TSource>(
13592 Expression.Call(
13593 null,
13594 #if CRIPPLED_REFLECTION
13595 InfoOf(() => Qbservable.SubscribeOn<TSource>(default(IQbservable<TSource>), default(SynchronizationContext))),
13596 #else
13597 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13598 #endif
13599 source.Expression,
13600 Expression.Constant(context, typeof(SynchronizationContext))
13601 )
13602 );
13603 }
13604
13605 /// <summary>
13606 /// Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
13607 /// see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.
13608 /// </summary>
13609 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13610 /// <param name="source">Source sequence.</param>
13611 /// <param name="scheduler">Scheduler to perform subscription and unsubscription actions on.</param>
13612 /// <returns>The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.</returns>
13613 /// <exception cref="T:System.ArgumentNullException">
13614 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
13615 /// <remarks>
13616 /// This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
13617 /// callbacks on a scheduler, use <see cref="M:System.Reactive.Linq.Observable.ObserveOn``1(System.IObservable{``0},System.Reactive.Concurrency.IScheduler)" />.
13618 /// </remarks>
13619 public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
13620 {
13621 if (source == null)
13622 throw new ArgumentNullException("source");
13623 if (scheduler == null)
13624 throw new ArgumentNullException("scheduler");
13625
13626 return source.Provider.CreateQuery<TSource>(
13627 Expression.Call(
13628 null,
13629 #if CRIPPLED_REFLECTION
13630 InfoOf(() => Qbservable.SubscribeOn<TSource>(default(IQbservable<TSource>), default(IScheduler))),
13631 #else
13632 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13633 #endif
13634 source.Expression,
13635 Expression.Constant(scheduler, typeof(IScheduler))
13636 )
13637 );
13638 }
13639
13640 /// <summary>
13641 /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.
13642 /// </summary>
13643 /// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
13644 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13645 /// <exception cref="T:System.ArgumentNullException">
13646 /// <paramref name="source" /> is null.</exception>
13647 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
13648 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13649 public static IQbservable<decimal> Sum(this IQbservable<decimal> source)
13650 {
13651 if (source == null)
13652 throw new ArgumentNullException("source");
13653
13654 return source.Provider.CreateQuery<decimal>(
13655 Expression.Call(
13656 null,
13657 #if CRIPPLED_REFLECTION
13658 InfoOf(() => Qbservable.Sum(default(IQbservable<decimal>))),
13659 #else
13660 (MethodInfo)MethodInfo.GetCurrentMethod(),
13661 #endif
13662 source.Expression
13663 )
13664 );
13665 }
13666
13667 /// <summary>
13668 /// Computes the sum of a sequence of <see cref="T:System.Double" /> values.
13669 /// </summary>
13670 /// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
13671 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13672 /// <exception cref="T:System.ArgumentNullException">
13673 /// <paramref name="source" /> is null.</exception>
13674 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13675 public static IQbservable<double> Sum(this IQbservable<double> source)
13676 {
13677 if (source == null)
13678 throw new ArgumentNullException("source");
13679
13680 return source.Provider.CreateQuery<double>(
13681 Expression.Call(
13682 null,
13683 #if CRIPPLED_REFLECTION
13684 InfoOf(() => Qbservable.Sum(default(IQbservable<double>))),
13685 #else
13686 (MethodInfo)MethodInfo.GetCurrentMethod(),
13687 #endif
13688 source.Expression
13689 )
13690 );
13691 }
13692
13693 /// <summary>
13694 /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values.
13695 /// </summary>
13696 /// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
13697 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13698 /// <exception cref="T:System.ArgumentNullException">
13699 /// <paramref name="source" /> is null.</exception>
13700 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
13701 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13702 public static IQbservable<int> Sum(this IQbservable<int> source)
13703 {
13704 if (source == null)
13705 throw new ArgumentNullException("source");
13706
13707 return source.Provider.CreateQuery<int>(
13708 Expression.Call(
13709 null,
13710 #if CRIPPLED_REFLECTION
13711 InfoOf(() => Qbservable.Sum(default(IQbservable<int>))),
13712 #else
13713 (MethodInfo)MethodInfo.GetCurrentMethod(),
13714 #endif
13715 source.Expression
13716 )
13717 );
13718 }
13719
13720 /// <summary>
13721 /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values.
13722 /// </summary>
13723 /// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
13724 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13725 /// <exception cref="T:System.ArgumentNullException">
13726 /// <paramref name="source" /> is null.</exception>
13727 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
13728 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13729 public static IQbservable<long> Sum(this IQbservable<long> source)
13730 {
13731 if (source == null)
13732 throw new ArgumentNullException("source");
13733
13734 return source.Provider.CreateQuery<long>(
13735 Expression.Call(
13736 null,
13737 #if CRIPPLED_REFLECTION
13738 InfoOf(() => Qbservable.Sum(default(IQbservable<long>))),
13739 #else
13740 (MethodInfo)MethodInfo.GetCurrentMethod(),
13741 #endif
13742 source.Expression
13743 )
13744 );
13745 }
13746
13747 /// <summary>
13748 /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.
13749 /// </summary>
13750 /// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
13751 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13752 /// <exception cref="T:System.ArgumentNullException">
13753 /// <paramref name="source" /> is null.</exception>
13754 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
13755 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13756 public static IQbservable<decimal?> Sum(this IQbservable<decimal?> source)
13757 {
13758 if (source == null)
13759 throw new ArgumentNullException("source");
13760
13761 return source.Provider.CreateQuery<decimal?>(
13762 Expression.Call(
13763 null,
13764 #if CRIPPLED_REFLECTION
13765 InfoOf(() => Qbservable.Sum(default(IQbservable<decimal?>))),
13766 #else
13767 (MethodInfo)MethodInfo.GetCurrentMethod(),
13768 #endif
13769 source.Expression
13770 )
13771 );
13772 }
13773
13774 /// <summary>
13775 /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.
13776 /// </summary>
13777 /// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
13778 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13779 /// <exception cref="T:System.ArgumentNullException">
13780 /// <paramref name="source" /> is null.</exception>
13781 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13782 public static IQbservable<double?> Sum(this IQbservable<double?> source)
13783 {
13784 if (source == null)
13785 throw new ArgumentNullException("source");
13786
13787 return source.Provider.CreateQuery<double?>(
13788 Expression.Call(
13789 null,
13790 #if CRIPPLED_REFLECTION
13791 InfoOf(() => Qbservable.Sum(default(IQbservable<double?>))),
13792 #else
13793 (MethodInfo)MethodInfo.GetCurrentMethod(),
13794 #endif
13795 source.Expression
13796 )
13797 );
13798 }
13799
13800 /// <summary>
13801 /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.
13802 /// </summary>
13803 /// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
13804 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13805 /// <exception cref="T:System.ArgumentNullException">
13806 /// <paramref name="source" /> is null.</exception>
13807 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
13808 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13809 public static IQbservable<int?> Sum(this IQbservable<int?> source)
13810 {
13811 if (source == null)
13812 throw new ArgumentNullException("source");
13813
13814 return source.Provider.CreateQuery<int?>(
13815 Expression.Call(
13816 null,
13817 #if CRIPPLED_REFLECTION
13818 InfoOf(() => Qbservable.Sum(default(IQbservable<int?>))),
13819 #else
13820 (MethodInfo)MethodInfo.GetCurrentMethod(),
13821 #endif
13822 source.Expression
13823 )
13824 );
13825 }
13826
13827 /// <summary>
13828 /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.
13829 /// </summary>
13830 /// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
13831 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13832 /// <exception cref="T:System.ArgumentNullException">
13833 /// <paramref name="source" /> is null.</exception>
13834 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
13835 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13836 public static IQbservable<long?> Sum(this IQbservable<long?> source)
13837 {
13838 if (source == null)
13839 throw new ArgumentNullException("source");
13840
13841 return source.Provider.CreateQuery<long?>(
13842 Expression.Call(
13843 null,
13844 #if CRIPPLED_REFLECTION
13845 InfoOf(() => Qbservable.Sum(default(IQbservable<long?>))),
13846 #else
13847 (MethodInfo)MethodInfo.GetCurrentMethod(),
13848 #endif
13849 source.Expression
13850 )
13851 );
13852 }
13853
13854 /// <summary>
13855 /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.
13856 /// </summary>
13857 /// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
13858 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13859 /// <exception cref="T:System.ArgumentNullException">
13860 /// <paramref name="source" /> is null.</exception>
13861 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13862 public static IQbservable<float?> Sum(this IQbservable<float?> source)
13863 {
13864 if (source == null)
13865 throw new ArgumentNullException("source");
13866
13867 return source.Provider.CreateQuery<float?>(
13868 Expression.Call(
13869 null,
13870 #if CRIPPLED_REFLECTION
13871 InfoOf(() => Qbservable.Sum(default(IQbservable<float?>))),
13872 #else
13873 (MethodInfo)MethodInfo.GetCurrentMethod(),
13874 #endif
13875 source.Expression
13876 )
13877 );
13878 }
13879
13880 /// <summary>
13881 /// Computes the sum of a sequence of <see cref="T:System.Single" /> values.
13882 /// </summary>
13883 /// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
13884 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13885 /// <exception cref="T:System.ArgumentNullException">
13886 /// <paramref name="source" /> is null.</exception>
13887 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13888 public static IQbservable<float> Sum(this IQbservable<float> source)
13889 {
13890 if (source == null)
13891 throw new ArgumentNullException("source");
13892
13893 return source.Provider.CreateQuery<float>(
13894 Expression.Call(
13895 null,
13896 #if CRIPPLED_REFLECTION
13897 InfoOf(() => Qbservable.Sum(default(IQbservable<float>))),
13898 #else
13899 (MethodInfo)MethodInfo.GetCurrentMethod(),
13900 #endif
13901 source.Expression
13902 )
13903 );
13904 }
13905
13906 /// <summary>
13907 /// Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
13908 /// </summary>
13909 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13910 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
13911 /// <param name="selector">A transform function to apply to each element.</param>
13912 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13913 /// <exception cref="T:System.ArgumentNullException">
13914 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
13915 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
13916 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13917 public static IQbservable<int?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int?>> selector)
13918 {
13919 if (source == null)
13920 throw new ArgumentNullException("source");
13921 if (selector == null)
13922 throw new ArgumentNullException("selector");
13923
13924 return source.Provider.CreateQuery<int?>(
13925 Expression.Call(
13926 null,
13927 #if CRIPPLED_REFLECTION
13928 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int?>>))),
13929 #else
13930 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13931 #endif
13932 source.Expression,
13933 selector
13934 )
13935 );
13936 }
13937
13938 /// <summary>
13939 /// Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
13940 /// </summary>
13941 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13942 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
13943 /// <param name="selector">A transform function to apply to each element.</param>
13944 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13945 /// <exception cref="T:System.ArgumentNullException">
13946 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
13947 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
13948 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13949 public static IQbservable<long?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long?>> selector)
13950 {
13951 if (source == null)
13952 throw new ArgumentNullException("source");
13953 if (selector == null)
13954 throw new ArgumentNullException("selector");
13955
13956 return source.Provider.CreateQuery<long?>(
13957 Expression.Call(
13958 null,
13959 #if CRIPPLED_REFLECTION
13960 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long?>>))),
13961 #else
13962 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13963 #endif
13964 source.Expression,
13965 selector
13966 )
13967 );
13968 }
13969
13970 /// <summary>
13971 /// Computes the sum of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
13972 /// </summary>
13973 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
13974 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
13975 /// <param name="selector">A transform function to apply to each element.</param>
13976 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
13977 /// <exception cref="T:System.ArgumentNullException">
13978 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
13979 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
13980 public static IQbservable<double> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double>> selector)
13981 {
13982 if (source == null)
13983 throw new ArgumentNullException("source");
13984 if (selector == null)
13985 throw new ArgumentNullException("selector");
13986
13987 return source.Provider.CreateQuery<double>(
13988 Expression.Call(
13989 null,
13990 #if CRIPPLED_REFLECTION
13991 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double>>))),
13992 #else
13993 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
13994 #endif
13995 source.Expression,
13996 selector
13997 )
13998 );
13999 }
14000
14001 /// <summary>
14002 /// Computes the sum of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
14003 /// </summary>
14004 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14005 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14006 /// <param name="selector">A transform function to apply to each element.</param>
14007 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14008 /// <exception cref="T:System.ArgumentNullException">
14009 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14010 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14011 public static IQbservable<float> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float>> selector)
14012 {
14013 if (source == null)
14014 throw new ArgumentNullException("source");
14015 if (selector == null)
14016 throw new ArgumentNullException("selector");
14017
14018 return source.Provider.CreateQuery<float>(
14019 Expression.Call(
14020 null,
14021 #if CRIPPLED_REFLECTION
14022 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float>>))),
14023 #else
14024 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14025 #endif
14026 source.Expression,
14027 selector
14028 )
14029 );
14030 }
14031
14032 /// <summary>
14033 /// Computes the sum of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
14034 /// </summary>
14035 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14036 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14037 /// <param name="selector">A transform function to apply to each element.</param>
14038 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14039 /// <exception cref="T:System.ArgumentNullException">
14040 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14041 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
14042 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14043 public static IQbservable<decimal> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal>> selector)
14044 {
14045 if (source == null)
14046 throw new ArgumentNullException("source");
14047 if (selector == null)
14048 throw new ArgumentNullException("selector");
14049
14050 return source.Provider.CreateQuery<decimal>(
14051 Expression.Call(
14052 null,
14053 #if CRIPPLED_REFLECTION
14054 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal>>))),
14055 #else
14056 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14057 #endif
14058 source.Expression,
14059 selector
14060 )
14061 );
14062 }
14063
14064 /// <summary>
14065 /// Computes the sum of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.
14066 /// </summary>
14067 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14068 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14069 /// <param name="selector">A transform function to apply to each element.</param>
14070 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14071 /// <exception cref="T:System.ArgumentNullException">
14072 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14073 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int32.MaxValue" />.</exception>
14074 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14075 public static IQbservable<int> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int>> selector)
14076 {
14077 if (source == null)
14078 throw new ArgumentNullException("source");
14079 if (selector == null)
14080 throw new ArgumentNullException("selector");
14081
14082 return source.Provider.CreateQuery<int>(
14083 Expression.Call(
14084 null,
14085 #if CRIPPLED_REFLECTION
14086 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int>>))),
14087 #else
14088 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14089 #endif
14090 source.Expression,
14091 selector
14092 )
14093 );
14094 }
14095
14096 /// <summary>
14097 /// Computes the sum of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.
14098 /// </summary>
14099 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14100 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14101 /// <param name="selector">A transform function to apply to each element.</param>
14102 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14103 /// <exception cref="T:System.ArgumentNullException">
14104 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14105 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Int64.MaxValue" />.</exception>
14106 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14107 public static IQbservable<long> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, long>> selector)
14108 {
14109 if (source == null)
14110 throw new ArgumentNullException("source");
14111 if (selector == null)
14112 throw new ArgumentNullException("selector");
14113
14114 return source.Provider.CreateQuery<long>(
14115 Expression.Call(
14116 null,
14117 #if CRIPPLED_REFLECTION
14118 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, long>>))),
14119 #else
14120 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14121 #endif
14122 source.Expression,
14123 selector
14124 )
14125 );
14126 }
14127
14128 /// <summary>
14129 /// Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.
14130 /// </summary>
14131 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14132 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14133 /// <param name="selector">A transform function to apply to each element.</param>
14134 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14135 /// <exception cref="T:System.ArgumentNullException">
14136 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14137 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14138 public static IQbservable<double?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, double?>> selector)
14139 {
14140 if (source == null)
14141 throw new ArgumentNullException("source");
14142 if (selector == null)
14143 throw new ArgumentNullException("selector");
14144
14145 return source.Provider.CreateQuery<double?>(
14146 Expression.Call(
14147 null,
14148 #if CRIPPLED_REFLECTION
14149 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, double?>>))),
14150 #else
14151 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14152 #endif
14153 source.Expression,
14154 selector
14155 )
14156 );
14157 }
14158
14159 /// <summary>
14160 /// Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.
14161 /// </summary>
14162 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14163 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14164 /// <param name="selector">A transform function to apply to each element.</param>
14165 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14166 /// <exception cref="T:System.ArgumentNullException">
14167 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14168 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14169 public static IQbservable<float?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, float?>> selector)
14170 {
14171 if (source == null)
14172 throw new ArgumentNullException("source");
14173 if (selector == null)
14174 throw new ArgumentNullException("selector");
14175
14176 return source.Provider.CreateQuery<float?>(
14177 Expression.Call(
14178 null,
14179 #if CRIPPLED_REFLECTION
14180 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, float?>>))),
14181 #else
14182 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14183 #endif
14184 source.Expression,
14185 selector
14186 )
14187 );
14188 }
14189
14190 /// <summary>
14191 /// Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.
14192 /// </summary>
14193 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14194 /// <param name="source">A sequence of values that are used to calculate a sum.</param>
14195 /// <param name="selector">A transform function to apply to each element.</param>
14196 /// <returns>An observable sequence containing a single element with the sum of the values in the source sequence.</returns>
14197 /// <exception cref="T:System.ArgumentNullException">
14198 /// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
14199 /// <exception cref="T:System.OverflowException">(Asynchronous) The sum of the projected values for the elements in the source sequence is larger than <see cref="M:System.Decimal.MaxValue" />.</exception>
14200 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
14201 public static IQbservable<decimal?> Sum<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, decimal?>> selector)
14202 {
14203 if (source == null)
14204 throw new ArgumentNullException("source");
14205 if (selector == null)
14206 throw new ArgumentNullException("selector");
14207
14208 return source.Provider.CreateQuery<decimal?>(
14209 Expression.Call(
14210 null,
14211 #if CRIPPLED_REFLECTION
14212 InfoOf(() => Qbservable.Sum<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, decimal?>>))),
14213 #else
14214 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14215 #endif
14216 source.Expression,
14217 selector
14218 )
14219 );
14220 }
14221
14222 /// <summary>
14223 /// Transforms an observable sequence of observable sequences into an observable sequence
14224 /// producing values only from the most recent observable sequence.
14225 /// Each time a new inner observable sequence is received, unsubscribe from the
14226 /// previous inner observable sequence.
14227 /// </summary>
14228 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
14229 /// <param name="sources">Observable sequence of inner observable sequences.</param>
14230 /// <returns>The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.</returns>
14231 /// <exception cref="T:System.ArgumentNullException">
14232 /// <paramref name="sources" /> is null.</exception>
14233 public static IQbservable<TSource> Switch<TSource>(this IQbservable<IObservable<TSource>> sources)
14234 {
14235 if (sources == null)
14236 throw new ArgumentNullException("sources");
14237
14238 return sources.Provider.CreateQuery<TSource>(
14239 Expression.Call(
14240 null,
14241 #if CRIPPLED_REFLECTION
14242 InfoOf(() => Qbservable.Switch<TSource>(default(IQbservable<IObservable<TSource>>))),
14243 #else
14244 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14245 #endif
14246 sources.Expression
14247 )
14248 );
14249 }
14250
14251 #if !NO_TPL
14252 /// <summary>
14253 /// Transforms an observable sequence of tasks into an observable sequence
14254 /// producing values only from the most recent observable sequence.
14255 /// Each time a new task is received, the previous task's result is ignored.
14256 /// </summary>
14257 /// <typeparam name="TSource">The type of the results produced by the source tasks.</typeparam>
14258 /// <param name="sources">Observable sequence of tasks.</param>
14259 /// <returns>The observable sequence that at any point in time produces the result of the most recent task that has been received.</returns>
14260 /// <exception cref="T:System.ArgumentNullException">
14261 /// <paramref name="sources" /> is null.</exception>
14262 /// <remarks>If the tasks support cancellation, consider manual conversion of the tasks using <see cref="M:System.Reactive.Linq.Observable.FromAsync``1(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task{``0}})" />, followed by a switch operation using <see cref="M:System.Reactive.Linq.Observable.Switch``1(System.IObservable{System.IObservable{``0}})" />.</remarks>
14263 public static IQbservable<TSource> Switch<TSource>(this IQbservable<Task<TSource>> sources)
14264 {
14265 if (sources == null)
14266 throw new ArgumentNullException("sources");
14267
14268 return sources.Provider.CreateQuery<TSource>(
14269 Expression.Call(
14270 null,
14271 #if CRIPPLED_REFLECTION
14272 InfoOf(() => Qbservable.Switch<TSource>(default(IQbservable<Task<TSource>>))),
14273 #else
14274 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14275 #endif
14276 sources.Expression
14277 )
14278 );
14279 }
14280 #endif
14281
14282 /// <summary>
14283 /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently.
14284 /// This overload is useful to "fix" an observable sequence that exhibits concurrent callbacks on individual observers, which is invalid behavior for the query processor.
14285 /// </summary>
14286 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14287 /// <param name="source">Source sequence.</param>
14288 /// <returns>The source sequence whose outgoing calls to observers are synchronized.</returns>
14289 /// <exception cref="T:System.ArgumentNullException">
14290 /// <paramref name="source" /> is null.</exception>
14291 /// <remarks>
14292 /// It's invalid behavior - according to the observer grammar - for a sequence to exhibit concurrent callbacks on a given observer.
14293 /// This operator can be used to "fix" a source that doesn't conform to this rule.
14294 /// </remarks>
14295 public static IQbservable<TSource> Synchronize<TSource>(this IQbservable<TSource> source)
14296 {
14297 if (source == null)
14298 throw new ArgumentNullException("source");
14299
14300 return source.Provider.CreateQuery<TSource>(
14301 Expression.Call(
14302 null,
14303 #if CRIPPLED_REFLECTION
14304 InfoOf(() => Qbservable.Synchronize<TSource>(default(IQbservable<TSource>))),
14305 #else
14306 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14307 #endif
14308 source.Expression
14309 )
14310 );
14311 }
14312
14313 /// <summary>
14314 /// Synchronizes the observable sequence such that observer notifications cannot be delivered concurrently, using the specified gate object.
14315 /// This overload is useful when writing n-ary query operators, in order to prevent concurrent callbacks from different sources by synchronizing on a common gate object.
14316 /// </summary>
14317 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14318 /// <param name="source">Source sequence.</param>
14319 /// <param name="gate">Gate object to synchronize each observer call on.</param>
14320 /// <returns>The source sequence whose outgoing calls to observers are synchronized on the given gate object.</returns>
14321 /// <exception cref="T:System.ArgumentNullException">
14322 /// <paramref name="source" /> or <paramref name="gate" /> is null.</exception>
14323 public static IQbservable<TSource> Synchronize<TSource>(this IQbservable<TSource> source, object gate)
14324 {
14325 if (source == null)
14326 throw new ArgumentNullException("source");
14327 if (gate == null)
14328 throw new ArgumentNullException("gate");
14329
14330 return source.Provider.CreateQuery<TSource>(
14331 Expression.Call(
14332 null,
14333 #if CRIPPLED_REFLECTION
14334 InfoOf(() => Qbservable.Synchronize<TSource>(default(IQbservable<TSource>), default(object))),
14335 #else
14336 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14337 #endif
14338 source.Expression,
14339 Expression.Constant(gate, typeof(object))
14340 )
14341 );
14342 }
14343
14344 /// <summary>
14345 /// Returns a specified number of contiguous elements from the start of an observable sequence.
14346 /// </summary>
14347 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14348 /// <param name="source">The sequence to take elements from.</param>
14349 /// <param name="count">The number of elements to return.</param>
14350 /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
14351 /// <exception cref="T:System.ArgumentNullException">
14352 /// <paramref name="source" /> is null.</exception>
14353 /// <exception cref="T:System.ArgumentOutOfRangeException">
14354 /// <paramref name="count" /> is less than zero.</exception>
14355 public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, int count)
14356 {
14357 if (source == null)
14358 throw new ArgumentNullException("source");
14359
14360 return source.Provider.CreateQuery<TSource>(
14361 Expression.Call(
14362 null,
14363 #if CRIPPLED_REFLECTION
14364 InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(int))),
14365 #else
14366 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14367 #endif
14368 source.Expression,
14369 Expression.Constant(count, typeof(int))
14370 )
14371 );
14372 }
14373
14374 /// <summary>
14375 /// Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of Take(0).
14376 /// </summary>
14377 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14378 /// <param name="source">The sequence to take elements from.</param>
14379 /// <param name="count">The number of elements to return.</param>
14380 /// <param name="scheduler">Scheduler used to produce an OnCompleted message in case <paramref name="count">count</paramref> is set to 0.</param>
14381 /// <returns>An observable sequence that contains the specified number of elements from the start of the input sequence.</returns>
14382 /// <exception cref="T:System.ArgumentNullException">
14383 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14384 /// <exception cref="T:System.ArgumentOutOfRangeException">
14385 /// <paramref name="count" /> is less than zero.</exception>
14386 public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, int count, IScheduler scheduler)
14387 {
14388 if (source == null)
14389 throw new ArgumentNullException("source");
14390 if (scheduler == null)
14391 throw new ArgumentNullException("scheduler");
14392
14393 return source.Provider.CreateQuery<TSource>(
14394 Expression.Call(
14395 null,
14396 #if CRIPPLED_REFLECTION
14397 InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(int), default(IScheduler))),
14398 #else
14399 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14400 #endif
14401 source.Expression,
14402 Expression.Constant(count, typeof(int)),
14403 Expression.Constant(scheduler, typeof(IScheduler))
14404 )
14405 );
14406 }
14407
14408 /// <summary>
14409 /// Takes elements for the specified duration from the start of the observable source sequence.
14410 /// </summary>
14411 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14412 /// <param name="source">Source sequence to take elements from.</param>
14413 /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
14414 /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
14415 /// <exception cref="T:System.ArgumentNullException">
14416 /// <paramref name="source" /> is null.</exception>
14417 /// <exception cref="T:System.ArgumentOutOfRangeException">
14418 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14419 /// <remarks>
14420 /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee an empty sequence will be returned. This is a side-effect
14421 /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
14422 /// immediately, despite the TimeSpan.Zero due time.
14423 /// </remarks>
14424 public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, TimeSpan duration)
14425 {
14426 if (source == null)
14427 throw new ArgumentNullException("source");
14428
14429 return source.Provider.CreateQuery<TSource>(
14430 Expression.Call(
14431 null,
14432 #if CRIPPLED_REFLECTION
14433 InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
14434 #else
14435 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14436 #endif
14437 source.Expression,
14438 Expression.Constant(duration, typeof(TimeSpan))
14439 )
14440 );
14441 }
14442
14443 /// <summary>
14444 /// Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
14445 /// </summary>
14446 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14447 /// <param name="source">Source sequence to take elements from.</param>
14448 /// <param name="duration">Duration for taking elements from the start of the sequence.</param>
14449 /// <param name="scheduler">Scheduler to run the timer on.</param>
14450 /// <returns>An observable sequence with the elements taken during the specified duration from the start of the source sequence.</returns>
14451 /// <exception cref="T:System.ArgumentNullException">
14452 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14453 /// <exception cref="T:System.ArgumentOutOfRangeException">
14454 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14455 /// <remarks>
14456 /// Specifying a TimeSpan.Zero value for <paramref name="duration" /> doesn't guarantee an empty sequence will be returned. This is a side-effect
14457 /// of the asynchrony introduced by the scheduler, where the action that stops forwarding callbacks from the source sequence may not execute
14458 /// immediately, despite the TimeSpan.Zero due time.
14459 /// </remarks>
14460 public static IQbservable<TSource> Take<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
14461 {
14462 if (source == null)
14463 throw new ArgumentNullException("source");
14464 if (scheduler == null)
14465 throw new ArgumentNullException("scheduler");
14466
14467 return source.Provider.CreateQuery<TSource>(
14468 Expression.Call(
14469 null,
14470 #if CRIPPLED_REFLECTION
14471 InfoOf(() => Qbservable.Take<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
14472 #else
14473 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14474 #endif
14475 source.Expression,
14476 Expression.Constant(duration, typeof(TimeSpan)),
14477 Expression.Constant(scheduler, typeof(IScheduler))
14478 )
14479 );
14480 }
14481
14482 /// <summary>
14483 /// Returns a specified number of contiguous elements from the end of an observable sequence.
14484 /// </summary>
14485 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14486 /// <param name="source">Source sequence.</param>
14487 /// <param name="count">Number of elements to take from the end of the source sequence.</param>
14488 /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
14489 /// <exception cref="T:System.ArgumentNullException">
14490 /// <paramref name="source" /> is null.</exception>
14491 /// <exception cref="T:System.ArgumentOutOfRangeException">
14492 /// <paramref name="count" /> is less than zero.</exception>
14493 /// <remarks>
14494 /// This operator accumulates a buffer with a length enough to store elements <paramref name="count" /> elements. Upon completion of
14495 /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
14496 /// </remarks>
14497 public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, int count)
14498 {
14499 if (source == null)
14500 throw new ArgumentNullException("source");
14501
14502 return source.Provider.CreateQuery<TSource>(
14503 Expression.Call(
14504 null,
14505 #if CRIPPLED_REFLECTION
14506 InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(int))),
14507 #else
14508 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14509 #endif
14510 source.Expression,
14511 Expression.Constant(count, typeof(int))
14512 )
14513 );
14514 }
14515
14516 /// <summary>
14517 /// Returns a specified number of contiguous elements from the end of an observable sequence, using the specified scheduler to drain the queue.
14518 /// </summary>
14519 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14520 /// <param name="source">Source sequence.</param>
14521 /// <param name="count">Number of elements to take from the end of the source sequence.</param>
14522 /// <param name="scheduler">Scheduler used to drain the queue upon completion of the source sequence.</param>
14523 /// <returns>An observable sequence containing the specified number of elements from the end of the source sequence.</returns>
14524 /// <exception cref="T:System.ArgumentNullException">
14525 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14526 /// <exception cref="T:System.ArgumentOutOfRangeException">
14527 /// <paramref name="count" /> is less than zero.</exception>
14528 /// <remarks>
14529 /// This operator accumulates a buffer with a length enough to store elements <paramref name="count" /> elements. Upon completion of
14530 /// the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
14531 /// </remarks>
14532 public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, int count, IScheduler scheduler)
14533 {
14534 if (source == null)
14535 throw new ArgumentNullException("source");
14536 if (scheduler == null)
14537 throw new ArgumentNullException("scheduler");
14538
14539 return source.Provider.CreateQuery<TSource>(
14540 Expression.Call(
14541 null,
14542 #if CRIPPLED_REFLECTION
14543 InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(int), default(IScheduler))),
14544 #else
14545 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14546 #endif
14547 source.Expression,
14548 Expression.Constant(count, typeof(int)),
14549 Expression.Constant(scheduler, typeof(IScheduler))
14550 )
14551 );
14552 }
14553
14554 /// <summary>
14555 /// Returns elements within the specified duration from the end of the observable source sequence.
14556 /// </summary>
14557 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14558 /// <param name="source">Source sequence to take elements from.</param>
14559 /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
14560 /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
14561 /// <exception cref="T:System.ArgumentNullException">
14562 /// <paramref name="source" /> is null.</exception>
14563 /// <exception cref="T:System.ArgumentOutOfRangeException">
14564 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14565 /// <remarks>
14566 /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
14567 /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
14568 /// to be delayed with <paramref name="duration" />.
14569 /// </remarks>
14570 public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration)
14571 {
14572 if (source == null)
14573 throw new ArgumentNullException("source");
14574
14575 return source.Provider.CreateQuery<TSource>(
14576 Expression.Call(
14577 null,
14578 #if CRIPPLED_REFLECTION
14579 InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
14580 #else
14581 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14582 #endif
14583 source.Expression,
14584 Expression.Constant(duration, typeof(TimeSpan))
14585 )
14586 );
14587 }
14588
14589 /// <summary>
14590 /// Returns elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
14591 /// </summary>
14592 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14593 /// <param name="source">Source sequence to take elements from.</param>
14594 /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
14595 /// <param name="scheduler">Scheduler to run the timer on.</param>
14596 /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
14597 /// <exception cref="T:System.ArgumentNullException">
14598 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14599 /// <exception cref="T:System.ArgumentOutOfRangeException">
14600 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14601 /// <remarks>
14602 /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
14603 /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
14604 /// to be delayed with <paramref name="duration" />.
14605 /// </remarks>
14606 public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
14607 {
14608 if (source == null)
14609 throw new ArgumentNullException("source");
14610 if (scheduler == null)
14611 throw new ArgumentNullException("scheduler");
14612
14613 return source.Provider.CreateQuery<TSource>(
14614 Expression.Call(
14615 null,
14616 #if CRIPPLED_REFLECTION
14617 InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
14618 #else
14619 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14620 #endif
14621 source.Expression,
14622 Expression.Constant(duration, typeof(TimeSpan)),
14623 Expression.Constant(scheduler, typeof(IScheduler))
14624 )
14625 );
14626 }
14627
14628 /// <summary>
14629 /// Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
14630 /// </summary>
14631 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14632 /// <param name="source">Source sequence to take elements from.</param>
14633 /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
14634 /// <param name="timerScheduler">Scheduler to run the timer on.</param>
14635 /// <param name="loopScheduler">Scheduler to drain the collected elements.</param>
14636 /// <returns>An observable sequence with the elements taken during the specified duration from the end of the source sequence.</returns>
14637 /// <exception cref="T:System.ArgumentNullException">
14638 /// <paramref name="source" /> or <paramref name="timerScheduler" /> or <paramref name="loopScheduler" /> is null.</exception>
14639 /// <exception cref="T:System.ArgumentOutOfRangeException">
14640 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14641 /// <remarks>
14642 /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
14643 /// the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
14644 /// to be delayed with <paramref name="duration" />.
14645 /// </remarks>
14646 public static IQbservable<TSource> TakeLast<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
14647 {
14648 if (source == null)
14649 throw new ArgumentNullException("source");
14650 if (timerScheduler == null)
14651 throw new ArgumentNullException("timerScheduler");
14652 if (loopScheduler == null)
14653 throw new ArgumentNullException("loopScheduler");
14654
14655 return source.Provider.CreateQuery<TSource>(
14656 Expression.Call(
14657 null,
14658 #if CRIPPLED_REFLECTION
14659 InfoOf(() => Qbservable.TakeLast<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler), default(IScheduler))),
14660 #else
14661 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14662 #endif
14663 source.Expression,
14664 Expression.Constant(duration, typeof(TimeSpan)),
14665 Expression.Constant(timerScheduler, typeof(IScheduler)),
14666 Expression.Constant(loopScheduler, typeof(IScheduler))
14667 )
14668 );
14669 }
14670
14671 /// <summary>
14672 /// Returns a list with the specified number of contiguous elements from the end of an observable sequence.
14673 /// </summary>
14674 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14675 /// <param name="source">Source sequence.</param>
14676 /// <param name="count">Number of elements to take from the end of the source sequence.</param>
14677 /// <returns>An observable sequence containing a single list with the specified number of elements from the end of the source sequence.</returns>
14678 /// <exception cref="T:System.ArgumentNullException">
14679 /// <paramref name="source" /> is null.</exception>
14680 /// <exception cref="T:System.ArgumentOutOfRangeException">
14681 /// <paramref name="count" /> is less than zero.</exception>
14682 /// <remarks>
14683 /// This operator accumulates a buffer with a length enough to store <paramref name="count" /> elements. Upon completion of the
14684 /// source sequence, this buffer is produced on the result sequence.
14685 /// </remarks>
14686 public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, int count)
14687 {
14688 if (source == null)
14689 throw new ArgumentNullException("source");
14690
14691 return source.Provider.CreateQuery<IList<TSource>>(
14692 Expression.Call(
14693 null,
14694 #if CRIPPLED_REFLECTION
14695 InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(int))),
14696 #else
14697 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14698 #endif
14699 source.Expression,
14700 Expression.Constant(count, typeof(int))
14701 )
14702 );
14703 }
14704
14705 /// <summary>
14706 /// Returns a list with the elements within the specified duration from the end of the observable source sequence.
14707 /// </summary>
14708 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14709 /// <param name="source">Source sequence to take elements from.</param>
14710 /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
14711 /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
14712 /// <exception cref="T:System.ArgumentNullException">
14713 /// <paramref name="source" /> is null.</exception>
14714 /// <exception cref="T:System.ArgumentOutOfRangeException">
14715 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14716 /// <remarks>
14717 /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
14718 /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
14719 /// </remarks>
14720 public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, TimeSpan duration)
14721 {
14722 if (source == null)
14723 throw new ArgumentNullException("source");
14724
14725 return source.Provider.CreateQuery<IList<TSource>>(
14726 Expression.Call(
14727 null,
14728 #if CRIPPLED_REFLECTION
14729 InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
14730 #else
14731 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14732 #endif
14733 source.Expression,
14734 Expression.Constant(duration, typeof(TimeSpan))
14735 )
14736 );
14737 }
14738
14739 /// <summary>
14740 /// Returns a list with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
14741 /// </summary>
14742 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14743 /// <param name="source">Source sequence to take elements from.</param>
14744 /// <param name="duration">Duration for taking elements from the end of the sequence.</param>
14745 /// <param name="scheduler">Scheduler to run the timer on.</param>
14746 /// <returns>An observable sequence containing a single list with the elements taken during the specified duration from the end of the source sequence.</returns>
14747 /// <exception cref="T:System.ArgumentNullException">
14748 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14749 /// <exception cref="T:System.ArgumentOutOfRangeException">
14750 /// <paramref name="duration" /> is less than TimeSpan.Zero.</exception>
14751 /// <remarks>
14752 /// This operator accumulates a buffer with a length enough to store elements for any <paramref name="duration" /> window during the lifetime of
14753 /// the source sequence. Upon completion of the source sequence, this buffer is produced on the result sequence.
14754 /// </remarks>
14755 public static IQbservable<IList<TSource>> TakeLastBuffer<TSource>(this IQbservable<TSource> source, TimeSpan duration, IScheduler scheduler)
14756 {
14757 if (source == null)
14758 throw new ArgumentNullException("source");
14759 if (scheduler == null)
14760 throw new ArgumentNullException("scheduler");
14761
14762 return source.Provider.CreateQuery<IList<TSource>>(
14763 Expression.Call(
14764 null,
14765 #if CRIPPLED_REFLECTION
14766 InfoOf(() => Qbservable.TakeLastBuffer<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
14767 #else
14768 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14769 #endif
14770 source.Expression,
14771 Expression.Constant(duration, typeof(TimeSpan)),
14772 Expression.Constant(scheduler, typeof(IScheduler))
14773 )
14774 );
14775 }
14776
14777 /// <summary>
14778 /// Takes elements for the specified duration until the specified end time.
14779 /// </summary>
14780 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14781 /// <param name="source">Source sequence to take elements from.</param>
14782 /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
14783 /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
14784 /// <exception cref="T:System.ArgumentNullException">
14785 /// <paramref name="source" /> is null.</exception>
14786 public static IQbservable<TSource> TakeUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset endTime)
14787 {
14788 if (source == null)
14789 throw new ArgumentNullException("source");
14790
14791 return source.Provider.CreateQuery<TSource>(
14792 Expression.Call(
14793 null,
14794 #if CRIPPLED_REFLECTION
14795 InfoOf(() => Qbservable.TakeUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
14796 #else
14797 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14798 #endif
14799 source.Expression,
14800 Expression.Constant(endTime, typeof(DateTimeOffset))
14801 )
14802 );
14803 }
14804
14805 /// <summary>
14806 /// Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
14807 /// </summary>
14808 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14809 /// <param name="source">Source sequence to take elements from.</param>
14810 /// <param name="endTime">Time to stop taking elements from the source sequence. If this value is less than or equal to DateTimeOffset.UtcNow, the result stream will complete immediately.</param>
14811 /// <param name="scheduler">Scheduler to run the timer on.</param>
14812 /// <returns>An observable sequence with the elements taken until the specified end time.</returns>
14813 /// <exception cref="T:System.ArgumentNullException">
14814 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14815 public static IQbservable<TSource> TakeUntil<TSource>(this IQbservable<TSource> source, DateTimeOffset endTime, IScheduler scheduler)
14816 {
14817 if (source == null)
14818 throw new ArgumentNullException("source");
14819 if (scheduler == null)
14820 throw new ArgumentNullException("scheduler");
14821
14822 return source.Provider.CreateQuery<TSource>(
14823 Expression.Call(
14824 null,
14825 #if CRIPPLED_REFLECTION
14826 InfoOf(() => Qbservable.TakeUntil<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
14827 #else
14828 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14829 #endif
14830 source.Expression,
14831 Expression.Constant(endTime, typeof(DateTimeOffset)),
14832 Expression.Constant(scheduler, typeof(IScheduler))
14833 )
14834 );
14835 }
14836
14837 /// <summary>
14838 /// Returns the elements from the source observable sequence until the other observable sequence produces an element.
14839 /// </summary>
14840 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14841 /// <typeparam name="TOther">The type of the elements in the other sequence that indicates the end of take behavior.</typeparam>
14842 /// <param name="source">Source sequence to propagate elements for.</param>
14843 /// <param name="other">Observable sequence that terminates propagation of elements of the source sequence.</param>
14844 /// <returns>An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.</returns>
14845 /// <exception cref="T:System.ArgumentNullException">
14846 /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
14847 public static IQbservable<TSource> TakeUntil<TSource, TOther>(this IQbservable<TSource> source, IObservable<TOther> other)
14848 {
14849 if (source == null)
14850 throw new ArgumentNullException("source");
14851 if (other == null)
14852 throw new ArgumentNullException("other");
14853
14854 return source.Provider.CreateQuery<TSource>(
14855 Expression.Call(
14856 null,
14857 #if CRIPPLED_REFLECTION
14858 InfoOf(() => Qbservable.TakeUntil<TSource, TOther>(default(IQbservable<TSource>), default(IObservable<TOther>))),
14859 #else
14860 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)),
14861 #endif
14862 source.Expression,
14863 GetSourceExpression(other)
14864 )
14865 );
14866 }
14867
14868 /// <summary>
14869 /// Returns elements from an observable sequence as long as a specified condition is true.
14870 /// </summary>
14871 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14872 /// <param name="source">A sequence to return elements from.</param>
14873 /// <param name="predicate">A function to test each element for a condition.</param>
14874 /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
14875 /// <exception cref="T:System.ArgumentNullException">
14876 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
14877 public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
14878 {
14879 if (source == null)
14880 throw new ArgumentNullException("source");
14881 if (predicate == null)
14882 throw new ArgumentNullException("predicate");
14883
14884 return source.Provider.CreateQuery<TSource>(
14885 Expression.Call(
14886 null,
14887 #if CRIPPLED_REFLECTION
14888 InfoOf(() => Qbservable.TakeWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
14889 #else
14890 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14891 #endif
14892 source.Expression,
14893 predicate
14894 )
14895 );
14896 }
14897
14898 /// <summary>
14899 /// Returns elements from an observable sequence as long as a specified condition is true.
14900 /// The element's index is used in the logic of the predicate function.
14901 /// </summary>
14902 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14903 /// <param name="source">A sequence to return elements from.</param>
14904 /// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the source element.</param>
14905 /// <returns>An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
14906 /// <exception cref="T:System.ArgumentNullException">
14907 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
14908 public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
14909 {
14910 if (source == null)
14911 throw new ArgumentNullException("source");
14912 if (predicate == null)
14913 throw new ArgumentNullException("predicate");
14914
14915 return source.Provider.CreateQuery<TSource>(
14916 Expression.Call(
14917 null,
14918 #if CRIPPLED_REFLECTION
14919 InfoOf(() => Qbservable.TakeWhile<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
14920 #else
14921 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14922 #endif
14923 source.Expression,
14924 predicate
14925 )
14926 );
14927 }
14928
14929 /// <summary>
14930 /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration.
14931 /// </summary>
14932 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14933 /// <param name="source">Source sequence to throttle.</param>
14934 /// <param name="dueTime">Throttling duration for each element.</param>
14935 /// <returns>The throttled sequence.</returns>
14936 /// <exception cref="T:System.ArgumentNullException">
14937 /// <paramref name="source" /> is null.</exception>
14938 /// <exception cref="T:System.ArgumentOutOfRangeException">
14939 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
14940 /// <remarks>
14941 /// <para>
14942 /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime" />. If another
14943 /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
14944 /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime" /> between elements, the resulting stream won't
14945 /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
14946 /// Observable.Sample set of operators.
14947 /// </para>
14948 /// <para>
14949 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing throttling timers to be scheduled
14950 /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
14951 /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
14952 /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
14953 /// </para>
14954 /// </remarks>
14955 public static IQbservable<TSource> Throttle<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
14956 {
14957 if (source == null)
14958 throw new ArgumentNullException("source");
14959
14960 return source.Provider.CreateQuery<TSource>(
14961 Expression.Call(
14962 null,
14963 #if CRIPPLED_REFLECTION
14964 InfoOf(() => Qbservable.Throttle<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
14965 #else
14966 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
14967 #endif
14968 source.Expression,
14969 Expression.Constant(dueTime, typeof(TimeSpan))
14970 )
14971 );
14972 }
14973
14974 /// <summary>
14975 /// Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.
14976 /// </summary>
14977 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
14978 /// <param name="source">Source sequence to throttle.</param>
14979 /// <param name="dueTime">Throttling duration for each element.</param>
14980 /// <param name="scheduler">Scheduler to run the throttle timers on.</param>
14981 /// <returns>The throttled sequence.</returns>
14982 /// <exception cref="T:System.ArgumentNullException">
14983 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
14984 /// <exception cref="T:System.ArgumentOutOfRangeException">
14985 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
14986 /// <remarks>
14987 /// <para>
14988 /// This operator throttles the source sequence by holding on to each element for the duration specified in <paramref name="dueTime" />. If another
14989 /// element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this whole
14990 /// process. For streams that never have gaps larger than or equal to <paramref name="dueTime" /> between elements, the resulting stream won't
14991 /// produce any elements. In order to reduce the volume of a stream whilst guaranteeing the periodic production of elements, consider using the
14992 /// Observable.Sample set of operators.
14993 /// </para>
14994 /// <para>
14995 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing throttling timers to be scheduled
14996 /// that are due immediately. However, this doesn't guarantee all elements will be retained in the result sequence. This is a side-effect of the
14997 /// asynchrony introduced by the scheduler, where the action to forward the current element may not execute immediately, despite the TimeSpan.Zero
14998 /// due time. In such cases, the next element may arrive before the scheduler gets a chance to run the throttling action.
14999 /// </para>
15000 /// </remarks>
15001 public static IQbservable<TSource> Throttle<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
15002 {
15003 if (source == null)
15004 throw new ArgumentNullException("source");
15005 if (scheduler == null)
15006 throw new ArgumentNullException("scheduler");
15007
15008 return source.Provider.CreateQuery<TSource>(
15009 Expression.Call(
15010 null,
15011 #if CRIPPLED_REFLECTION
15012 InfoOf(() => Qbservable.Throttle<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
15013 #else
15014 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15015 #endif
15016 source.Expression,
15017 Expression.Constant(dueTime, typeof(TimeSpan)),
15018 Expression.Constant(scheduler, typeof(IScheduler))
15019 )
15020 );
15021 }
15022
15023 /// <summary>
15024 /// Ignores elements from an observable sequence which are followed by another value within a computed throttle duration.
15025 /// </summary>
15026 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15027 /// <typeparam name="TThrottle">The type of the elements in the throttle sequences selected for each element in the source sequence.</typeparam>
15028 /// <param name="source">Source sequence to throttle.</param>
15029 /// <param name="throttleDurationSelector">Selector function to retrieve a sequence indicating the throttle duration for each given element.</param>
15030 /// <returns>The throttled sequence.</returns>
15031 /// <exception cref="T:System.ArgumentNullException">
15032 /// <paramref name="source" /> or <paramref name="throttleDurationSelector" /> is null.</exception>
15033 /// <remarks>
15034 /// This operator throttles the source sequence by holding on to each element for the duration denoted by <paramref name="throttleDurationSelector" />.
15035 /// If another element is produced within this time window, the element is dropped and a new timer is started for the current element, repeating this
15036 /// whole process. For streams where the duration computed by applying the <paramref name="throttleDurationSelector" /> to each element overlaps with
15037 /// the occurrence of the successor element, the resulting stream won't produce any elements. In order to reduce the volume of a stream whilst
15038 /// guaranteeing the periodic production of elements, consider using the Observable.Sample set of operators.
15039 /// </remarks>
15040 public static IQbservable<TSource> Throttle<TSource, TThrottle>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TThrottle>>> throttleDurationSelector)
15041 {
15042 if (source == null)
15043 throw new ArgumentNullException("source");
15044 if (throttleDurationSelector == null)
15045 throw new ArgumentNullException("throttleDurationSelector");
15046
15047 return source.Provider.CreateQuery<TSource>(
15048 Expression.Call(
15049 null,
15050 #if CRIPPLED_REFLECTION
15051 InfoOf(() => Qbservable.Throttle<TSource, TThrottle>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TThrottle>>>))),
15052 #else
15053 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TThrottle)),
15054 #endif
15055 source.Expression,
15056 throttleDurationSelector
15057 )
15058 );
15059 }
15060
15061 /// <summary>
15062 /// Returns an observable sequence that terminates with an exception.
15063 /// </summary>
15064 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15065 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
15066 /// <param name="exception">Exception object used for the sequence's termination.</param>
15067 /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
15068 /// <exception cref="T:System.ArgumentNullException">
15069 /// <paramref name="exception" /> is null.</exception>
15070 public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception)
15071 {
15072 if (provider == null)
15073 throw new ArgumentNullException("provider");
15074 if (exception == null)
15075 throw new ArgumentNullException("exception");
15076
15077 return provider.CreateQuery<TResult>(
15078 Expression.Call(
15079 null,
15080 #if CRIPPLED_REFLECTION
15081 InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception))),
15082 #else
15083 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
15084 #endif
15085 Expression.Constant(provider, typeof(IQbservableProvider)),
15086 Expression.Constant(exception, typeof(Exception))
15087 )
15088 );
15089 }
15090
15091 /// <summary>
15092 /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
15093 /// </summary>
15094 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15095 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
15096 /// <param name="exception">Exception object used for the sequence's termination.</param>
15097 /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
15098 /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
15099 /// <exception cref="T:System.ArgumentNullException">
15100 /// <paramref name="exception" /> or <paramref name="scheduler" /> is null.</exception>
15101 public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, IScheduler scheduler)
15102 {
15103 if (provider == null)
15104 throw new ArgumentNullException("provider");
15105 if (exception == null)
15106 throw new ArgumentNullException("exception");
15107 if (scheduler == null)
15108 throw new ArgumentNullException("scheduler");
15109
15110 return provider.CreateQuery<TResult>(
15111 Expression.Call(
15112 null,
15113 #if CRIPPLED_REFLECTION
15114 InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(IScheduler))),
15115 #else
15116 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
15117 #endif
15118 Expression.Constant(provider, typeof(IQbservableProvider)),
15119 Expression.Constant(exception, typeof(Exception)),
15120 Expression.Constant(scheduler, typeof(IScheduler))
15121 )
15122 );
15123 }
15124
15125 /// <summary>
15126 /// Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
15127 /// </summary>
15128 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15129 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
15130 /// <param name="exception">Exception object used for the sequence's termination.</param>
15131 /// <param name="scheduler">Scheduler to send the exceptional termination call on.</param>
15132 /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
15133 /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
15134 /// <exception cref="T:System.ArgumentNullException">
15135 /// <paramref name="exception" /> or <paramref name="scheduler" /> is null.</exception>
15136 public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, IScheduler scheduler, TResult witness)
15137 {
15138 if (provider == null)
15139 throw new ArgumentNullException("provider");
15140 if (exception == null)
15141 throw new ArgumentNullException("exception");
15142 if (scheduler == null)
15143 throw new ArgumentNullException("scheduler");
15144
15145 return provider.CreateQuery<TResult>(
15146 Expression.Call(
15147 null,
15148 #if CRIPPLED_REFLECTION
15149 InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(IScheduler), default(TResult))),
15150 #else
15151 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
15152 #endif
15153 Expression.Constant(provider, typeof(IQbservableProvider)),
15154 Expression.Constant(exception, typeof(Exception)),
15155 Expression.Constant(scheduler, typeof(IScheduler)),
15156 Expression.Constant(witness, typeof(TResult))
15157 )
15158 );
15159 }
15160
15161 /// <summary>
15162 /// Returns an observable sequence that terminates with an exception.
15163 /// </summary>
15164 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15165 /// <typeparam name="TResult">The type used for the IObservable&lt;T&gt; type parameter of the resulting sequence.</typeparam>
15166 /// <param name="exception">Exception object used for the sequence's termination.</param>
15167 /// <param name="witness">Object solely used to infer the type of the <typeparamref name="TResult" /> type parameter. This parameter is typically used when creating a sequence of anonymously typed elements.</param>
15168 /// <returns>The observable sequence that terminates exceptionally with the specified exception object.</returns>
15169 /// <exception cref="T:System.ArgumentNullException">
15170 /// <paramref name="exception" /> is null.</exception>
15171 public static IQbservable<TResult> Throw<TResult>(this IQbservableProvider provider, Exception exception, TResult witness)
15172 {
15173 if (provider == null)
15174 throw new ArgumentNullException("provider");
15175 if (exception == null)
15176 throw new ArgumentNullException("exception");
15177
15178 return provider.CreateQuery<TResult>(
15179 Expression.Call(
15180 null,
15181 #if CRIPPLED_REFLECTION
15182 InfoOf(() => Qbservable.Throw<TResult>(default(IQbservableProvider), default(Exception), default(TResult))),
15183 #else
15184 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)),
15185 #endif
15186 Expression.Constant(provider, typeof(IQbservableProvider)),
15187 Expression.Constant(exception, typeof(Exception)),
15188 Expression.Constant(witness, typeof(TResult))
15189 )
15190 );
15191 }
15192
15193 /// <summary>
15194 /// Records the time interval between consecutive elements in an observable sequence.
15195 /// </summary>
15196 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15197 /// <param name="source">Source sequence to record time intervals for.</param>
15198 /// <returns>An observable sequence with time interval information on elements.</returns>
15199 /// <exception cref="T:System.ArgumentNullException">
15200 /// <paramref name="source" /> is null.</exception>
15201 public static IQbservable<TimeInterval<TSource>> TimeInterval<TSource>(this IQbservable<TSource> source)
15202 {
15203 if (source == null)
15204 throw new ArgumentNullException("source");
15205
15206 return source.Provider.CreateQuery<TimeInterval<TSource>>(
15207 Expression.Call(
15208 null,
15209 #if CRIPPLED_REFLECTION
15210 InfoOf(() => Qbservable.TimeInterval<TSource>(default(IQbservable<TSource>))),
15211 #else
15212 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15213 #endif
15214 source.Expression
15215 )
15216 );
15217 }
15218
15219 /// <summary>
15220 /// Records the time interval between consecutive elements in an observable sequence, using the specified scheduler to compute time intervals.
15221 /// </summary>
15222 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15223 /// <param name="source">Source sequence to record time intervals for.</param>
15224 /// <param name="scheduler">Scheduler used to compute time intervals.</param>
15225 /// <returns>An observable sequence with time interval information on elements.</returns>
15226 /// <exception cref="T:System.ArgumentNullException">
15227 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
15228 public static IQbservable<TimeInterval<TSource>> TimeInterval<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
15229 {
15230 if (source == null)
15231 throw new ArgumentNullException("source");
15232 if (scheduler == null)
15233 throw new ArgumentNullException("scheduler");
15234
15235 return source.Provider.CreateQuery<TimeInterval<TSource>>(
15236 Expression.Call(
15237 null,
15238 #if CRIPPLED_REFLECTION
15239 InfoOf(() => Qbservable.TimeInterval<TSource>(default(IQbservable<TSource>), default(IScheduler))),
15240 #else
15241 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15242 #endif
15243 source.Expression,
15244 Expression.Constant(scheduler, typeof(IScheduler))
15245 )
15246 );
15247 }
15248
15249 /// <summary>
15250 /// Applies a timeout policy to the observable sequence based on an absolute time.
15251 /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
15252 /// </summary>
15253 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15254 /// <param name="source">Source sequence to perform a timeout for.</param>
15255 /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
15256 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15257 /// <exception cref="T:System.ArgumentNullException">
15258 /// <paramref name="source" /> is null.</exception>
15259 /// <exception cref="T:System.TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime" />.</exception>
15260 /// <remarks>
15261 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15262 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15263 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15264 /// </remarks>
15265 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
15266 {
15267 if (source == null)
15268 throw new ArgumentNullException("source");
15269
15270 return source.Provider.CreateQuery<TSource>(
15271 Expression.Call(
15272 null,
15273 #if CRIPPLED_REFLECTION
15274 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset))),
15275 #else
15276 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15277 #endif
15278 source.Expression,
15279 Expression.Constant(dueTime, typeof(DateTimeOffset))
15280 )
15281 );
15282 }
15283
15284 /// <summary>
15285 /// Applies a timeout policy to the observable sequence based on an absolute time.
15286 /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
15287 /// </summary>
15288 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15289 /// <param name="source">Source sequence to perform a timeout for.</param>
15290 /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
15291 /// <param name="other">Sequence to return in case of a timeout.</param>
15292 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15293 /// <exception cref="T:System.ArgumentNullException">
15294 /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
15295 /// <remarks>
15296 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15297 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15298 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15299 /// </remarks>
15300 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)
15301 {
15302 if (source == null)
15303 throw new ArgumentNullException("source");
15304 if (other == null)
15305 throw new ArgumentNullException("other");
15306
15307 return source.Provider.CreateQuery<TSource>(
15308 Expression.Call(
15309 null,
15310 #if CRIPPLED_REFLECTION
15311 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IObservable<TSource>))),
15312 #else
15313 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15314 #endif
15315 source.Expression,
15316 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15317 GetSourceExpression(other)
15318 )
15319 );
15320 }
15321
15322 /// <summary>
15323 /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
15324 /// If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.
15325 /// </summary>
15326 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15327 /// <param name="source">Source sequence to perform a timeout for.</param>
15328 /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
15329 /// <param name="other">Sequence to return in case of a timeout.</param>
15330 /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
15331 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15332 /// <exception cref="T:System.ArgumentNullException">
15333 /// <paramref name="source" /> or <paramref name="other" /> or <paramref name="scheduler" /> is null.</exception>
15334 /// <remarks>
15335 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15336 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15337 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15338 /// </remarks>
15339 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
15340 {
15341 if (source == null)
15342 throw new ArgumentNullException("source");
15343 if (other == null)
15344 throw new ArgumentNullException("other");
15345 if (scheduler == null)
15346 throw new ArgumentNullException("scheduler");
15347
15348 return source.Provider.CreateQuery<TSource>(
15349 Expression.Call(
15350 null,
15351 #if CRIPPLED_REFLECTION
15352 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IObservable<TSource>), default(IScheduler))),
15353 #else
15354 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15355 #endif
15356 source.Expression,
15357 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15358 GetSourceExpression(other),
15359 Expression.Constant(scheduler, typeof(IScheduler))
15360 )
15361 );
15362 }
15363
15364 /// <summary>
15365 /// Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers.
15366 /// If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.
15367 /// </summary>
15368 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15369 /// <param name="source">Source sequence to perform a timeout for.</param>
15370 /// <param name="dueTime">Time when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.</param>
15371 /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
15372 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15373 /// <exception cref="T:System.ArgumentNullException">
15374 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
15375 /// <exception cref="T:System.TimeoutException">(Asynchronous) If the sequence hasn't terminated before <paramref name="dueTime" />.</exception>
15376 /// <remarks>
15377 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15378 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15379 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15380 /// </remarks>
15381 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
15382 {
15383 if (source == null)
15384 throw new ArgumentNullException("source");
15385 if (scheduler == null)
15386 throw new ArgumentNullException("scheduler");
15387
15388 return source.Provider.CreateQuery<TSource>(
15389 Expression.Call(
15390 null,
15391 #if CRIPPLED_REFLECTION
15392 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(DateTimeOffset), default(IScheduler))),
15393 #else
15394 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15395 #endif
15396 source.Expression,
15397 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15398 Expression.Constant(scheduler, typeof(IScheduler))
15399 )
15400 );
15401 }
15402
15403 /// <summary>
15404 /// Applies a timeout policy for each element in the observable sequence.
15405 /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
15406 /// </summary>
15407 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15408 /// <param name="source">Source sequence to perform a timeout for.</param>
15409 /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
15410 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15411 /// <exception cref="T:System.ArgumentNullException">
15412 /// <paramref name="source" /> is null.</exception>
15413 /// <exception cref="T:System.ArgumentOutOfRangeException">
15414 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
15415 /// <exception cref="T:System.TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime" /> from the previous element.</exception>
15416 /// <remarks>
15417 /// <para>
15418 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15419 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15420 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15421 /// </para>
15422 /// <para>
15423 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
15424 /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
15425 /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
15426 /// arrive before the scheduler gets a chance to run the timeout action.
15427 /// </para>
15428 /// </remarks>
15429 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
15430 {
15431 if (source == null)
15432 throw new ArgumentNullException("source");
15433
15434 return source.Provider.CreateQuery<TSource>(
15435 Expression.Call(
15436 null,
15437 #if CRIPPLED_REFLECTION
15438 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
15439 #else
15440 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15441 #endif
15442 source.Expression,
15443 Expression.Constant(dueTime, typeof(TimeSpan))
15444 )
15445 );
15446 }
15447
15448 /// <summary>
15449 /// Applies a timeout policy for each element in the observable sequence.
15450 /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
15451 /// </summary>
15452 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15453 /// <param name="source">Source sequence to perform a timeout for.</param>
15454 /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
15455 /// <param name="other">Sequence to return in case of a timeout.</param>
15456 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15457 /// <exception cref="T:System.ArgumentNullException">
15458 /// <paramref name="source" /> or <paramref name="other" /> is null.</exception>
15459 /// <exception cref="T:System.ArgumentOutOfRangeException">
15460 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
15461 /// <remarks>
15462 /// <para>
15463 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15464 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15465 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15466 /// </para>
15467 /// <para>
15468 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
15469 /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
15470 /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
15471 /// arrive before the scheduler gets a chance to run the timeout action.
15472 /// </para>
15473 /// </remarks>
15474 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)
15475 {
15476 if (source == null)
15477 throw new ArgumentNullException("source");
15478 if (other == null)
15479 throw new ArgumentNullException("other");
15480
15481 return source.Provider.CreateQuery<TSource>(
15482 Expression.Call(
15483 null,
15484 #if CRIPPLED_REFLECTION
15485 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IObservable<TSource>))),
15486 #else
15487 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15488 #endif
15489 source.Expression,
15490 Expression.Constant(dueTime, typeof(TimeSpan)),
15491 GetSourceExpression(other)
15492 )
15493 );
15494 }
15495
15496 /// <summary>
15497 /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
15498 /// If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
15499 /// </summary>
15500 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15501 /// <param name="source">Source sequence to perform a timeout for.</param>
15502 /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
15503 /// <param name="other">Sequence to return in case of a timeout.</param>
15504 /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
15505 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15506 /// <exception cref="T:System.ArgumentNullException">
15507 /// <paramref name="source" /> or <paramref name="other" /> or <paramref name="scheduler" /> is null.</exception>
15508 /// <exception cref="T:System.ArgumentOutOfRangeException">
15509 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
15510 /// <remarks>
15511 /// <para>
15512 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15513 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15514 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15515 /// </para>
15516 /// <para>
15517 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
15518 /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
15519 /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
15520 /// arrive before the scheduler gets a chance to run the timeout action.
15521 /// </para>
15522 /// </remarks>
15523 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
15524 {
15525 if (source == null)
15526 throw new ArgumentNullException("source");
15527 if (other == null)
15528 throw new ArgumentNullException("other");
15529 if (scheduler == null)
15530 throw new ArgumentNullException("scheduler");
15531
15532 return source.Provider.CreateQuery<TSource>(
15533 Expression.Call(
15534 null,
15535 #if CRIPPLED_REFLECTION
15536 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IObservable<TSource>), default(IScheduler))),
15537 #else
15538 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15539 #endif
15540 source.Expression,
15541 Expression.Constant(dueTime, typeof(TimeSpan)),
15542 GetSourceExpression(other),
15543 Expression.Constant(scheduler, typeof(IScheduler))
15544 )
15545 );
15546 }
15547
15548 /// <summary>
15549 /// Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers.
15550 /// If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.
15551 /// </summary>
15552 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15553 /// <param name="source">Source sequence to perform a timeout for.</param>
15554 /// <param name="dueTime">Maximum duration between values before a timeout occurs.</param>
15555 /// <param name="scheduler">Scheduler to run the timeout timers on.</param>
15556 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15557 /// <exception cref="T:System.ArgumentNullException">
15558 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
15559 /// <exception cref="T:System.ArgumentOutOfRangeException">
15560 /// <paramref name="dueTime" /> is less than TimeSpan.Zero.</exception>
15561 /// <exception cref="T:System.TimeoutException">(Asynchronous) If no element is produced within <paramref name="dueTime" /> from the previous element.</exception>
15562 /// <remarks>
15563 /// <para>
15564 /// In case you only want to timeout on the first element, consider using the <see cref="M:System.Reactive.Linq.Observable.Amb``1(System.IObservable{``0},System.IObservable{``0})" />
15565 /// operator applied to the source sequence and a delayed <see cref="M:System.Reactive.Linq.Observable.Throw``1(System.Exception)" /> sequence. Alternatively, the general-purpose overload
15566 /// of Timeout, <see cref="M:System.Reactive.Linq.Observable.Timeout``2(System.IObservable{``0},System.IObservable{``1},System.Func{``0,System.IObservable{``1}})" /> can be used.
15567 /// </para>
15568 /// <para>
15569 /// Specifying a TimeSpan.Zero value for <paramref name="dueTime" /> is not recommended but supported, causing timeout timers to be scheduled that are due
15570 /// immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the
15571 /// scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may
15572 /// arrive before the scheduler gets a chance to run the timeout action.
15573 /// </para>
15574 /// </remarks>
15575 public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
15576 {
15577 if (source == null)
15578 throw new ArgumentNullException("source");
15579 if (scheduler == null)
15580 throw new ArgumentNullException("scheduler");
15581
15582 return source.Provider.CreateQuery<TSource>(
15583 Expression.Call(
15584 null,
15585 #if CRIPPLED_REFLECTION
15586 InfoOf(() => Qbservable.Timeout<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
15587 #else
15588 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
15589 #endif
15590 source.Expression,
15591 Expression.Constant(dueTime, typeof(TimeSpan)),
15592 Expression.Constant(scheduler, typeof(IScheduler))
15593 )
15594 );
15595 }
15596
15597 /// <summary>
15598 /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
15599 /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
15600 /// </summary>
15601 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15602 /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
15603 /// <param name="source">Source sequence to perform a timeout for.</param>
15604 /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
15605 /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
15606 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15607 /// <exception cref="T:System.ArgumentNullException">
15608 /// <paramref name="source" /> or <paramref name="firstTimeout" /> or <paramref name="timeoutDurationSelector" /> is null.</exception>
15609 public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
15610 {
15611 if (source == null)
15612 throw new ArgumentNullException("source");
15613 if (firstTimeout == null)
15614 throw new ArgumentNullException("firstTimeout");
15615 if (timeoutDurationSelector == null)
15616 throw new ArgumentNullException("timeoutDurationSelector");
15617
15618 return source.Provider.CreateQuery<TSource>(
15619 Expression.Call(
15620 null,
15621 #if CRIPPLED_REFLECTION
15622 InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(IObservable<TTimeout>), default(Expression<Func<TSource, IObservable<TTimeout>>>))),
15623 #else
15624 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
15625 #endif
15626 source.Expression,
15627 GetSourceExpression(firstTimeout),
15628 timeoutDurationSelector
15629 )
15630 );
15631 }
15632
15633 /// <summary>
15634 /// Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element.
15635 /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
15636 /// </summary>
15637 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15638 /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
15639 /// <param name="source">Source sequence to perform a timeout for.</param>
15640 /// <param name="firstTimeout">Observable sequence that represents the timeout for the first element.</param>
15641 /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
15642 /// <param name="other">Sequence to return in case of a timeout.</param>
15643 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15644 /// <exception cref="T:System.ArgumentNullException">
15645 /// <paramref name="source" /> or <paramref name="firstTimeout" /> or <paramref name="timeoutDurationSelector" /> or <paramref name="other" /> is null.</exception>
15646 public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)
15647 {
15648 if (source == null)
15649 throw new ArgumentNullException("source");
15650 if (firstTimeout == null)
15651 throw new ArgumentNullException("firstTimeout");
15652 if (timeoutDurationSelector == null)
15653 throw new ArgumentNullException("timeoutDurationSelector");
15654 if (other == null)
15655 throw new ArgumentNullException("other");
15656
15657 return source.Provider.CreateQuery<TSource>(
15658 Expression.Call(
15659 null,
15660 #if CRIPPLED_REFLECTION
15661 InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(IObservable<TTimeout>), default(Expression<Func<TSource, IObservable<TTimeout>>>), default(IObservable<TSource>))),
15662 #else
15663 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
15664 #endif
15665 source.Expression,
15666 GetSourceExpression(firstTimeout),
15667 timeoutDurationSelector,
15668 GetSourceExpression(other)
15669 )
15670 );
15671 }
15672
15673 /// <summary>
15674 /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
15675 /// If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.
15676 /// </summary>
15677 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15678 /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
15679 /// <param name="source">Source sequence to perform a timeout for.</param>
15680 /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
15681 /// <returns>The source sequence with a TimeoutException in case of a timeout.</returns>
15682 /// <exception cref="T:System.ArgumentNullException">
15683 /// <paramref name="source" /> or <paramref name="timeoutDurationSelector" /> is null.</exception>
15684 public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
15685 {
15686 if (source == null)
15687 throw new ArgumentNullException("source");
15688 if (timeoutDurationSelector == null)
15689 throw new ArgumentNullException("timeoutDurationSelector");
15690
15691 return source.Provider.CreateQuery<TSource>(
15692 Expression.Call(
15693 null,
15694 #if CRIPPLED_REFLECTION
15695 InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TTimeout>>>))),
15696 #else
15697 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
15698 #endif
15699 source.Expression,
15700 timeoutDurationSelector
15701 )
15702 );
15703 }
15704
15705 /// <summary>
15706 /// Applies a timeout policy to the observable sequence based on a timeout duration computed for each element.
15707 /// If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.
15708 /// </summary>
15709 /// <typeparam name="TSource">The type of the elements in the source sequence and the other sequence used upon a timeout.</typeparam>
15710 /// <typeparam name="TTimeout">The type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.</typeparam>
15711 /// <param name="source">Source sequence to perform a timeout for.</param>
15712 /// <param name="timeoutDurationSelector">Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.</param>
15713 /// <param name="other">Sequence to return in case of a timeout.</param>
15714 /// <returns>The source sequence switching to the other sequence in case of a timeout.</returns>
15715 /// <exception cref="T:System.ArgumentNullException">
15716 /// <paramref name="source" /> or <paramref name="timeoutDurationSelector" /> or <paramref name="other" /> is null.</exception>
15717 public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)
15718 {
15719 if (source == null)
15720 throw new ArgumentNullException("source");
15721 if (timeoutDurationSelector == null)
15722 throw new ArgumentNullException("timeoutDurationSelector");
15723 if (other == null)
15724 throw new ArgumentNullException("other");
15725
15726 return source.Provider.CreateQuery<TSource>(
15727 Expression.Call(
15728 null,
15729 #if CRIPPLED_REFLECTION
15730 InfoOf(() => Qbservable.Timeout<TSource, TTimeout>(default(IQbservable<TSource>), default(Expression<Func<TSource, IObservable<TTimeout>>>), default(IObservable<TSource>))),
15731 #else
15732 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TTimeout)),
15733 #endif
15734 source.Expression,
15735 timeoutDurationSelector,
15736 GetSourceExpression(other)
15737 )
15738 );
15739 }
15740
15741 /// <summary>
15742 /// Returns an observable sequence that produces a single value at the specified absolute due time.
15743 /// </summary>
15744 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15745 /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
15746 /// <returns>An observable sequence that produces a value at due time.</returns>
15747 public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime)
15748 {
15749 if (provider == null)
15750 throw new ArgumentNullException("provider");
15751
15752 return provider.CreateQuery<long>(
15753 Expression.Call(
15754 null,
15755 #if CRIPPLED_REFLECTION
15756 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset))),
15757 #else
15758 (MethodInfo)MethodInfo.GetCurrentMethod(),
15759 #endif
15760 Expression.Constant(provider, typeof(IQbservableProvider)),
15761 Expression.Constant(dueTime, typeof(DateTimeOffset))
15762 )
15763 );
15764 }
15765
15766 /// <summary>
15767 /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time.
15768 /// </summary>
15769 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15770 /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
15771 /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
15772 /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
15773 /// <exception cref="T:System.ArgumentOutOfRangeException">
15774 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
15775 public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, TimeSpan period)
15776 {
15777 if (provider == null)
15778 throw new ArgumentNullException("provider");
15779
15780 return provider.CreateQuery<long>(
15781 Expression.Call(
15782 null,
15783 #if CRIPPLED_REFLECTION
15784 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(TimeSpan))),
15785 #else
15786 (MethodInfo)MethodInfo.GetCurrentMethod(),
15787 #endif
15788 Expression.Constant(provider, typeof(IQbservableProvider)),
15789 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15790 Expression.Constant(period, typeof(TimeSpan))
15791 )
15792 );
15793 }
15794
15795 /// <summary>
15796 /// Returns an observable sequence that periodically produces a value starting at the specified initial absolute due time, using the specified scheduler to run timers.
15797 /// </summary>
15798 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15799 /// <param name="dueTime">Absolute time at which to produce the first value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
15800 /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
15801 /// <param name="scheduler">Scheduler to run timers on.</param>
15802 /// <returns>An observable sequence that produces a value at due time and then after each period.</returns>
15803 /// <exception cref="T:System.ArgumentOutOfRangeException">
15804 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
15805 /// <exception cref="T:System.ArgumentNullException">
15806 /// <paramref name="scheduler" /> is null.</exception>
15807 public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler)
15808 {
15809 if (provider == null)
15810 throw new ArgumentNullException("provider");
15811 if (scheduler == null)
15812 throw new ArgumentNullException("scheduler");
15813
15814 return provider.CreateQuery<long>(
15815 Expression.Call(
15816 null,
15817 #if CRIPPLED_REFLECTION
15818 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(TimeSpan), default(IScheduler))),
15819 #else
15820 (MethodInfo)MethodInfo.GetCurrentMethod(),
15821 #endif
15822 Expression.Constant(provider, typeof(IQbservableProvider)),
15823 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15824 Expression.Constant(period, typeof(TimeSpan)),
15825 Expression.Constant(scheduler, typeof(IScheduler))
15826 )
15827 );
15828 }
15829
15830 /// <summary>
15831 /// Returns an observable sequence that produces a single value at the specified absolute due time, using the specified scheduler to run the timer.
15832 /// </summary>
15833 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15834 /// <param name="dueTime">Absolute time at which to produce the value. If this value is less than or equal to DateTimeOffset.UtcNow, the timer will fire as soon as possible.</param>
15835 /// <param name="scheduler">Scheduler to run the timer on.</param>
15836 /// <returns>An observable sequence that produces a value at due time.</returns>
15837 /// <exception cref="T:System.ArgumentNullException">
15838 /// <paramref name="scheduler" /> is null.</exception>
15839 public static IQbservable<long> Timer(this IQbservableProvider provider, DateTimeOffset dueTime, IScheduler scheduler)
15840 {
15841 if (provider == null)
15842 throw new ArgumentNullException("provider");
15843 if (scheduler == null)
15844 throw new ArgumentNullException("scheduler");
15845
15846 return provider.CreateQuery<long>(
15847 Expression.Call(
15848 null,
15849 #if CRIPPLED_REFLECTION
15850 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(DateTimeOffset), default(IScheduler))),
15851 #else
15852 (MethodInfo)MethodInfo.GetCurrentMethod(),
15853 #endif
15854 Expression.Constant(provider, typeof(IQbservableProvider)),
15855 Expression.Constant(dueTime, typeof(DateTimeOffset)),
15856 Expression.Constant(scheduler, typeof(IScheduler))
15857 )
15858 );
15859 }
15860
15861 /// <summary>
15862 /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed.
15863 /// </summary>
15864 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15865 /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
15866 /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
15867 public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime)
15868 {
15869 if (provider == null)
15870 throw new ArgumentNullException("provider");
15871
15872 return provider.CreateQuery<long>(
15873 Expression.Call(
15874 null,
15875 #if CRIPPLED_REFLECTION
15876 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan))),
15877 #else
15878 (MethodInfo)MethodInfo.GetCurrentMethod(),
15879 #endif
15880 Expression.Constant(provider, typeof(IQbservableProvider)),
15881 Expression.Constant(dueTime, typeof(TimeSpan))
15882 )
15883 );
15884 }
15885
15886 /// <summary>
15887 /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed.
15888 /// </summary>
15889 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15890 /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
15891 /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
15892 /// <returns>An observable sequence that produces a value after due time has elapsed and then after each period.</returns>
15893 /// <exception cref="T:System.ArgumentOutOfRangeException">
15894 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
15895 public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, TimeSpan period)
15896 {
15897 if (provider == null)
15898 throw new ArgumentNullException("provider");
15899
15900 return provider.CreateQuery<long>(
15901 Expression.Call(
15902 null,
15903 #if CRIPPLED_REFLECTION
15904 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(TimeSpan))),
15905 #else
15906 (MethodInfo)MethodInfo.GetCurrentMethod(),
15907 #endif
15908 Expression.Constant(provider, typeof(IQbservableProvider)),
15909 Expression.Constant(dueTime, typeof(TimeSpan)),
15910 Expression.Constant(period, typeof(TimeSpan))
15911 )
15912 );
15913 }
15914
15915 /// <summary>
15916 /// Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.
15917 /// </summary>
15918 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15919 /// <param name="dueTime">Relative time at which to produce the first value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
15920 /// <param name="period">Period to produce subsequent values. If this value is equal to TimeSpan.Zero, the timer will recur as fast as possible.</param>
15921 /// <param name="scheduler">Scheduler to run timers on.</param>
15922 /// <returns>An observable sequence that produces a value after due time has elapsed and then each period.</returns>
15923 /// <exception cref="T:System.ArgumentOutOfRangeException">
15924 /// <paramref name="period" /> is less than TimeSpan.Zero.</exception>
15925 /// <exception cref="T:System.ArgumentNullException">
15926 /// <paramref name="scheduler" /> is null.</exception>
15927 public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, TimeSpan period, IScheduler scheduler)
15928 {
15929 if (provider == null)
15930 throw new ArgumentNullException("provider");
15931 if (scheduler == null)
15932 throw new ArgumentNullException("scheduler");
15933
15934 return provider.CreateQuery<long>(
15935 Expression.Call(
15936 null,
15937 #if CRIPPLED_REFLECTION
15938 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(TimeSpan), default(IScheduler))),
15939 #else
15940 (MethodInfo)MethodInfo.GetCurrentMethod(),
15941 #endif
15942 Expression.Constant(provider, typeof(IQbservableProvider)),
15943 Expression.Constant(dueTime, typeof(TimeSpan)),
15944 Expression.Constant(period, typeof(TimeSpan)),
15945 Expression.Constant(scheduler, typeof(IScheduler))
15946 )
15947 );
15948 }
15949
15950 /// <summary>
15951 /// Returns an observable sequence that produces a single value after the specified relative due time has elapsed, using the specified scheduler to run the timer.
15952 /// </summary>
15953 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
15954 /// <param name="dueTime">Relative time at which to produce the value. If this value is less than or equal to TimeSpan.Zero, the timer will fire as soon as possible.</param>
15955 /// <param name="scheduler">Scheduler to run the timer on.</param>
15956 /// <returns>An observable sequence that produces a value after the due time has elapsed.</returns>
15957 /// <exception cref="T:System.ArgumentNullException">
15958 /// <paramref name="scheduler" /> is null.</exception>
15959 public static IQbservable<long> Timer(this IQbservableProvider provider, TimeSpan dueTime, IScheduler scheduler)
15960 {
15961 if (provider == null)
15962 throw new ArgumentNullException("provider");
15963 if (scheduler == null)
15964 throw new ArgumentNullException("scheduler");
15965
15966 return provider.CreateQuery<long>(
15967 Expression.Call(
15968 null,
15969 #if CRIPPLED_REFLECTION
15970 InfoOf(() => Qbservable.Timer(default(IQbservableProvider), default(TimeSpan), default(IScheduler))),
15971 #else
15972 (MethodInfo)MethodInfo.GetCurrentMethod(),
15973 #endif
15974 Expression.Constant(provider, typeof(IQbservableProvider)),
15975 Expression.Constant(dueTime, typeof(TimeSpan)),
15976 Expression.Constant(scheduler, typeof(IScheduler))
15977 )
15978 );
15979 }
15980
15981 /// <summary>
15982 /// Timestamps each element in an observable sequence using the local system clock.
15983 /// </summary>
15984 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
15985 /// <param name="source">Source sequence to timestamp elements for.</param>
15986 /// <returns>An observable sequence with timestamp information on elements.</returns>
15987 /// <exception cref="T:System.ArgumentNullException">
15988 /// <paramref name="source" /> is null.</exception>
15989 public static IQbservable<Timestamped<TSource>> Timestamp<TSource>(this IQbservable<TSource> source)
15990 {
15991 if (source == null)
15992 throw new ArgumentNullException("source");
15993
15994 return source.Provider.CreateQuery<Timestamped<TSource>>(
15995 Expression.Call(
15996 null,
15997 #if CRIPPLED_REFLECTION
15998 InfoOf(() => Qbservable.Timestamp<TSource>(default(IQbservable<TSource>))),
15999 #else
16000 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16001 #endif
16002 source.Expression
16003 )
16004 );
16005 }
16006
16007 /// <summary>
16008 /// Timestamp each element in an observable sequence using the clock of the specified scheduler.
16009 /// </summary>
16010 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16011 /// <param name="source">Source sequence to timestamp elements for.</param>
16012 /// <param name="scheduler">Scheduler used to compute timestamps.</param>
16013 /// <returns>An observable sequence with timestamp information on elements.</returns>
16014 /// <exception cref="T:System.ArgumentNullException">
16015 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
16016 public static IQbservable<Timestamped<TSource>> Timestamp<TSource>(this IQbservable<TSource> source, IScheduler scheduler)
16017 {
16018 if (source == null)
16019 throw new ArgumentNullException("source");
16020 if (scheduler == null)
16021 throw new ArgumentNullException("scheduler");
16022
16023 return source.Provider.CreateQuery<Timestamped<TSource>>(
16024 Expression.Call(
16025 null,
16026 #if CRIPPLED_REFLECTION
16027 InfoOf(() => Qbservable.Timestamp<TSource>(default(IQbservable<TSource>), default(IScheduler))),
16028 #else
16029 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16030 #endif
16031 source.Expression,
16032 Expression.Constant(scheduler, typeof(IScheduler))
16033 )
16034 );
16035 }
16036
16037 /// <summary>
16038 /// Creates an array from an observable sequence.
16039 /// </summary>
16040 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16041 /// <param name="source">The source observable sequence to get an array of elements for.</param>
16042 /// <returns>An observable sequence containing a single element with an array containing all the elements of the source sequence.</returns>
16043 /// <exception cref="T:System.ArgumentNullException">
16044 /// <paramref name="source" /> is null.</exception>
16045 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16046 public static IQbservable<TSource[]> ToArray<TSource>(this IQbservable<TSource> source)
16047 {
16048 if (source == null)
16049 throw new ArgumentNullException("source");
16050
16051 return source.Provider.CreateQuery<TSource[]>(
16052 Expression.Call(
16053 null,
16054 #if CRIPPLED_REFLECTION
16055 InfoOf(() => Qbservable.ToArray<TSource>(default(IQbservable<TSource>))),
16056 #else
16057 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16058 #endif
16059 source.Expression
16060 )
16061 );
16062 }
16063
16064 /// <summary>
16065 /// Creates a dictionary from an observable sequence according to a specified key selector function.
16066 /// </summary>
16067 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16068 /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
16069 /// <param name="source">An observable sequence to create a dictionary for.</param>
16070 /// <param name="keySelector">A function to extract a key from each element.</param>
16071 /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
16072 /// <exception cref="T:System.ArgumentNullException">
16073 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
16074 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16075 public static IQbservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
16076 {
16077 if (source == null)
16078 throw new ArgumentNullException("source");
16079 if (keySelector == null)
16080 throw new ArgumentNullException("keySelector");
16081
16082 return source.Provider.CreateQuery<IDictionary<TKey, TSource>>(
16083 Expression.Call(
16084 null,
16085 #if CRIPPLED_REFLECTION
16086 InfoOf(() => Qbservable.ToDictionary<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
16087 #else
16088 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
16089 #endif
16090 source.Expression,
16091 keySelector
16092 )
16093 );
16094 }
16095
16096 /// <summary>
16097 /// Creates a dictionary from an observable sequence according to a specified key selector function, and a comparer.
16098 /// </summary>
16099 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16100 /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
16101 /// <param name="source">An observable sequence to create a dictionary for.</param>
16102 /// <param name="keySelector">A function to extract a key from each element.</param>
16103 /// <param name="comparer">An equality comparer to compare keys.</param>
16104 /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
16105 /// <exception cref="T:System.ArgumentNullException">
16106 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
16107 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16108 public static IQbservable<IDictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
16109 {
16110 if (source == null)
16111 throw new ArgumentNullException("source");
16112 if (keySelector == null)
16113 throw new ArgumentNullException("keySelector");
16114 if (comparer == null)
16115 throw new ArgumentNullException("comparer");
16116
16117 return source.Provider.CreateQuery<IDictionary<TKey, TSource>>(
16118 Expression.Call(
16119 null,
16120 #if CRIPPLED_REFLECTION
16121 InfoOf(() => Qbservable.ToDictionary<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
16122 #else
16123 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
16124 #endif
16125 source.Expression,
16126 keySelector,
16127 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
16128 )
16129 );
16130 }
16131
16132 /// <summary>
16133 /// Creates a dictionary from an observable sequence according to a specified key selector function, and an element selector function.
16134 /// </summary>
16135 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16136 /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
16137 /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
16138 /// <param name="source">An observable sequence to create a dictionary for.</param>
16139 /// <param name="keySelector">A function to extract a key from each element.</param>
16140 /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
16141 /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
16142 /// <exception cref="T:System.ArgumentNullException">
16143 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
16144 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16145 public static IQbservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
16146 {
16147 if (source == null)
16148 throw new ArgumentNullException("source");
16149 if (keySelector == null)
16150 throw new ArgumentNullException("keySelector");
16151 if (elementSelector == null)
16152 throw new ArgumentNullException("elementSelector");
16153
16154 return source.Provider.CreateQuery<IDictionary<TKey, TElement>>(
16155 Expression.Call(
16156 null,
16157 #if CRIPPLED_REFLECTION
16158 InfoOf(() => Qbservable.ToDictionary<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
16159 #else
16160 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
16161 #endif
16162 source.Expression,
16163 keySelector,
16164 elementSelector
16165 )
16166 );
16167 }
16168
16169 /// <summary>
16170 /// Creates a dictionary from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
16171 /// </summary>
16172 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16173 /// <typeparam name="TKey">The type of the dictionary key computed for each element in the source sequence.</typeparam>
16174 /// <typeparam name="TElement">The type of the dictionary value computed for each element in the source sequence.</typeparam>
16175 /// <param name="source">An observable sequence to create a dictionary for.</param>
16176 /// <param name="keySelector">A function to extract a key from each element.</param>
16177 /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
16178 /// <param name="comparer">An equality comparer to compare keys.</param>
16179 /// <returns>An observable sequence containing a single element with a dictionary mapping unique key values onto the corresponding source sequence's element.</returns>
16180 /// <exception cref="T:System.ArgumentNullException">
16181 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
16182 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16183 public static IQbservable<IDictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
16184 {
16185 if (source == null)
16186 throw new ArgumentNullException("source");
16187 if (keySelector == null)
16188 throw new ArgumentNullException("keySelector");
16189 if (elementSelector == null)
16190 throw new ArgumentNullException("elementSelector");
16191 if (comparer == null)
16192 throw new ArgumentNullException("comparer");
16193
16194 return source.Provider.CreateQuery<IDictionary<TKey, TElement>>(
16195 Expression.Call(
16196 null,
16197 #if CRIPPLED_REFLECTION
16198 InfoOf(() => Qbservable.ToDictionary<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
16199 #else
16200 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
16201 #endif
16202 source.Expression,
16203 keySelector,
16204 elementSelector,
16205 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
16206 )
16207 );
16208 }
16209
16210 /// <summary>
16211 /// Converts an observable sequence to an enumerable sequence.
16212 /// </summary>
16213 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16214 /// <param name="source">An observable sequence to convert to an enumerable sequence.</param>
16215 /// <returns>The enumerable sequence containing the elements in the observable sequence.</returns>
16216 /// <exception cref="T:System.ArgumentNullException">
16217 /// <paramref name="source" /> is null.</exception>
16218 /// <remarks>This operator requires the source's <see cref="IQbservableProvider"/> object (see <see cref="IQbservable.Provider"/>) to implement <see cref="IQueryProvider"/>.</remarks>
16219 public static IQueryable<TSource> ToQueryable<TSource>(this IQbservable<TSource> source)
16220 {
16221 if (source == null)
16222 throw new ArgumentNullException("source");
16223
16224 return ((IQueryProvider)source.Provider).CreateQuery<TSource>(
16225 Expression.Call(
16226 null,
16227 #if CRIPPLED_REFLECTION
16228 InfoOf(() => Qbservable.ToQueryable<TSource>(default(IQbservable<TSource>))),
16229 #else
16230 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16231 #endif
16232 source.Expression
16233 )
16234 );
16235 }
16236
16237 /// <summary>
16238 /// Creates a list from an observable sequence.
16239 /// </summary>
16240 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16241 /// <param name="source">The source observable sequence to get a list of elements for.</param>
16242 /// <returns>An observable sequence containing a single element with a list containing all the elements of the source sequence.</returns>
16243 /// <exception cref="T:System.ArgumentNullException">
16244 /// <paramref name="source" /> is null.</exception>
16245 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16246 public static IQbservable<IList<TSource>> ToList<TSource>(this IQbservable<TSource> source)
16247 {
16248 if (source == null)
16249 throw new ArgumentNullException("source");
16250
16251 return source.Provider.CreateQuery<IList<TSource>>(
16252 Expression.Call(
16253 null,
16254 #if CRIPPLED_REFLECTION
16255 InfoOf(() => Qbservable.ToList<TSource>(default(IQbservable<TSource>))),
16256 #else
16257 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16258 #endif
16259 source.Expression
16260 )
16261 );
16262 }
16263
16264 /// <summary>
16265 /// Creates a lookup from an observable sequence according to a specified key selector function.
16266 /// </summary>
16267 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16268 /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
16269 /// <param name="source">An observable sequence to create a lookup for.</param>
16270 /// <param name="keySelector">A function to extract a key from each element.</param>
16271 /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
16272 /// <exception cref="T:System.ArgumentNullException">
16273 /// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
16274 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16275 public static IQbservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
16276 {
16277 if (source == null)
16278 throw new ArgumentNullException("source");
16279 if (keySelector == null)
16280 throw new ArgumentNullException("keySelector");
16281
16282 return source.Provider.CreateQuery<ILookup<TKey, TSource>>(
16283 Expression.Call(
16284 null,
16285 #if CRIPPLED_REFLECTION
16286 InfoOf(() => Qbservable.ToLookup<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>))),
16287 #else
16288 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
16289 #endif
16290 source.Expression,
16291 keySelector
16292 )
16293 );
16294 }
16295
16296 /// <summary>
16297 /// Creates a lookup from an observable sequence according to a specified key selector function, and a comparer.
16298 /// </summary>
16299 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16300 /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
16301 /// <param name="source">An observable sequence to create a lookup for.</param>
16302 /// <param name="keySelector">A function to extract a key from each element.</param>
16303 /// <param name="comparer">An equality comparer to compare keys.</param>
16304 /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
16305 /// <exception cref="T:System.ArgumentNullException">
16306 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
16307 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16308 public static IQbservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
16309 {
16310 if (source == null)
16311 throw new ArgumentNullException("source");
16312 if (keySelector == null)
16313 throw new ArgumentNullException("keySelector");
16314 if (comparer == null)
16315 throw new ArgumentNullException("comparer");
16316
16317 return source.Provider.CreateQuery<ILookup<TKey, TSource>>(
16318 Expression.Call(
16319 null,
16320 #if CRIPPLED_REFLECTION
16321 InfoOf(() => Qbservable.ToLookup<TSource, TKey>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))),
16322 #else
16323 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)),
16324 #endif
16325 source.Expression,
16326 keySelector,
16327 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
16328 )
16329 );
16330 }
16331
16332 /// <summary>
16333 /// Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function.
16334 /// </summary>
16335 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16336 /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
16337 /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
16338 /// <param name="source">An observable sequence to create a lookup for.</param>
16339 /// <param name="keySelector">A function to extract a key from each element.</param>
16340 /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
16341 /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
16342 /// <exception cref="T:System.ArgumentNullException">
16343 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
16344 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16345 public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
16346 {
16347 if (source == null)
16348 throw new ArgumentNullException("source");
16349 if (keySelector == null)
16350 throw new ArgumentNullException("keySelector");
16351 if (elementSelector == null)
16352 throw new ArgumentNullException("elementSelector");
16353
16354 return source.Provider.CreateQuery<ILookup<TKey, TElement>>(
16355 Expression.Call(
16356 null,
16357 #if CRIPPLED_REFLECTION
16358 InfoOf(() => Qbservable.ToLookup<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))),
16359 #else
16360 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
16361 #endif
16362 source.Expression,
16363 keySelector,
16364 elementSelector
16365 )
16366 );
16367 }
16368
16369 /// <summary>
16370 /// Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function.
16371 /// </summary>
16372 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16373 /// <typeparam name="TKey">The type of the lookup key computed for each element in the source sequence.</typeparam>
16374 /// <typeparam name="TElement">The type of the lookup value computed for each element in the source sequence.</typeparam>
16375 /// <param name="source">An observable sequence to create a lookup for.</param>
16376 /// <param name="keySelector">A function to extract a key from each element.</param>
16377 /// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
16378 /// <param name="comparer">An equality comparer to compare keys.</param>
16379 /// <returns>An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.</returns>
16380 /// <exception cref="T:System.ArgumentNullException">
16381 /// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
16382 /// <remarks>The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.</remarks>
16383 public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
16384 {
16385 if (source == null)
16386 throw new ArgumentNullException("source");
16387 if (keySelector == null)
16388 throw new ArgumentNullException("keySelector");
16389 if (elementSelector == null)
16390 throw new ArgumentNullException("elementSelector");
16391 if (comparer == null)
16392 throw new ArgumentNullException("comparer");
16393
16394 return source.Provider.CreateQuery<ILookup<TKey, TElement>>(
16395 Expression.Call(
16396 null,
16397 #if CRIPPLED_REFLECTION
16398 InfoOf(() => Qbservable.ToLookup<TSource, TKey, TElement>(default(IQbservable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))),
16399 #else
16400 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)),
16401 #endif
16402 source.Expression,
16403 keySelector,
16404 elementSelector,
16405 Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))
16406 )
16407 );
16408 }
16409
16410 /// <summary>
16411 /// Converts an enumerable sequence to an observable sequence.
16412 /// </summary>
16413 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
16414 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16415 /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
16416 /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
16417 /// <exception cref="T:System.ArgumentNullException">
16418 /// <paramref name="source" /> is null.</exception>
16419 public static IQbservable<TSource> ToObservable<TSource>(this IQbservableProvider provider, IEnumerable<TSource> source)
16420 {
16421 if (provider == null)
16422 throw new ArgumentNullException("provider");
16423 if (source == null)
16424 throw new ArgumentNullException("source");
16425
16426 return provider.CreateQuery<TSource>(
16427 Expression.Call(
16428 null,
16429 #if CRIPPLED_REFLECTION
16430 InfoOf(() => Qbservable.ToObservable<TSource>(default(IQbservableProvider), default(IEnumerable<TSource>))),
16431 #else
16432 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16433 #endif
16434 Expression.Constant(provider, typeof(IQbservableProvider)),
16435 GetSourceExpression(source)
16436 )
16437 );
16438 }
16439
16440 /// <summary>
16441 /// Converts an enumerable sequence to an observable sequence, using the specified scheduler to run the enumeration loop.
16442 /// </summary>
16443 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
16444 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16445 /// <param name="source">Enumerable sequence to convert to an observable sequence.</param>
16446 /// <param name="scheduler">Scheduler to run the enumeration of the input sequence on.</param>
16447 /// <returns>The observable sequence whose elements are pulled from the given enumerable sequence.</returns>
16448 /// <exception cref="T:System.ArgumentNullException">
16449 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
16450 public static IQbservable<TSource> ToObservable<TSource>(this IQbservableProvider provider, IEnumerable<TSource> source, IScheduler scheduler)
16451 {
16452 if (provider == null)
16453 throw new ArgumentNullException("provider");
16454 if (source == null)
16455 throw new ArgumentNullException("source");
16456 if (scheduler == null)
16457 throw new ArgumentNullException("scheduler");
16458
16459 return provider.CreateQuery<TSource>(
16460 Expression.Call(
16461 null,
16462 #if CRIPPLED_REFLECTION
16463 InfoOf(() => Qbservable.ToObservable<TSource>(default(IQbservableProvider), default(IEnumerable<TSource>), default(IScheduler))),
16464 #else
16465 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16466 #endif
16467 Expression.Constant(provider, typeof(IQbservableProvider)),
16468 GetSourceExpression(source),
16469 Expression.Constant(scheduler, typeof(IScheduler))
16470 )
16471 );
16472 }
16473
16474 /// <summary>
16475 /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
16476 /// </summary>
16477 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
16478 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
16479 /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="T:System.IDisposable" />.</typeparam>
16480 /// <param name="resourceFactory">Factory function to obtain a resource object.</param>
16481 /// <param name="observableFactory">Factory function to obtain an observable sequence that depends on the obtained resource.</param>
16482 /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
16483 /// <exception cref="T:System.ArgumentNullException">
16484 /// <paramref name="resourceFactory" /> or <paramref name="observableFactory" /> is null.</exception>
16485 public static IQbservable<TResult> Using<TResult, TResource>(this IQbservableProvider provider, Expression<Func<TResource>> resourceFactory, Expression<Func<TResource, IObservable<TResult>>> observableFactory)
16486 where TResource : IDisposable
16487 {
16488 if (provider == null)
16489 throw new ArgumentNullException("provider");
16490 if (resourceFactory == null)
16491 throw new ArgumentNullException("resourceFactory");
16492 if (observableFactory == null)
16493 throw new ArgumentNullException("observableFactory");
16494
16495 return provider.CreateQuery<TResult>(
16496 Expression.Call(
16497 null,
16498 #if CRIPPLED_REFLECTION
16499 InfoOf(() => Qbservable.Using<TResult, TResource>(default(IQbservableProvider), default(Expression<Func<TResource>>), default(Expression<Func<TResource, IObservable<TResult>>>))),
16500 #else
16501 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult), typeof(TResource)),
16502 #endif
16503 Expression.Constant(provider, typeof(IQbservableProvider)),
16504 resourceFactory,
16505 observableFactory
16506 )
16507 );
16508 }
16509
16510 #if !NO_TPL
16511 /// <summary>
16512 /// Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime. The resource is obtained and used through asynchronous methods.
16513 /// The CancellationToken passed to the asynchronous methods is tied to the returned disposable subscription, allowing best-effort cancellation at any stage of the resource acquisition or usage.
16514 /// </summary>
16515 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
16516 /// <typeparam name="TResult">The type of the elements in the produced sequence.</typeparam>
16517 /// <typeparam name="TResource">The type of the resource used during the generation of the resulting sequence. Needs to implement <see cref="T:System.IDisposable" />.</typeparam>
16518 /// <param name="resourceFactoryAsync">Asynchronous factory function to obtain a resource object.</param>
16519 /// <param name="observableFactoryAsync">Asynchronous factory function to obtain an observable sequence that depends on the obtained resource.</param>
16520 /// <returns>An observable sequence whose lifetime controls the lifetime of the dependent resource object.</returns>
16521 /// <exception cref="T:System.ArgumentNullException">
16522 /// <paramref name="resourceFactoryAsync" /> or <paramref name="observableFactoryAsync" /> is null.</exception>
16523 /// <remarks>This operator is especially useful in conjunction with the asynchronous programming features introduced in C# 5.0 and Visual Basic 11.</remarks>
16524 /// <remarks>When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous resource factory and observable factory functions will be signaled.</remarks>
16525 public static IQbservable<TResult> Using<TResult, TResource>(this IQbservableProvider provider, Expression<Func<CancellationToken, Task<TResource>>> resourceFactoryAsync, Expression<Func<TResource, CancellationToken, Task<IObservable<TResult>>>> observableFactoryAsync)
16526 where TResource : IDisposable
16527 {
16528 if (provider == null)
16529 throw new ArgumentNullException("provider");
16530 if (resourceFactoryAsync == null)
16531 throw new ArgumentNullException("resourceFactoryAsync");
16532 if (observableFactoryAsync == null)
16533 throw new ArgumentNullException("observableFactoryAsync");
16534
16535 return provider.CreateQuery<TResult>(
16536 Expression.Call(
16537 null,
16538 #if CRIPPLED_REFLECTION
16539 InfoOf(() => Qbservable.Using<TResult, TResource>(default(IQbservableProvider), default(Expression<Func<CancellationToken, Task<TResource>>>), default(Expression<Func<TResource, CancellationToken, Task<IObservable<TResult>>>>))),
16540 #else
16541 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult), typeof(TResource)),
16542 #endif
16543 Expression.Constant(provider, typeof(IQbservableProvider)),
16544 resourceFactoryAsync,
16545 observableFactoryAsync
16546 )
16547 );
16548 }
16549 #endif
16550
16551 /// <summary>
16552 /// Filters the elements of an observable sequence based on a predicate.
16553 /// </summary>
16554 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16555 /// <param name="source">An observable sequence whose elements to filter.</param>
16556 /// <param name="predicate">A function to test each source element for a condition.</param>
16557 /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
16558 /// <exception cref="T:System.ArgumentNullException">
16559 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
16560 public static IQbservable<TSource> Where<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
16561 {
16562 if (source == null)
16563 throw new ArgumentNullException("source");
16564 if (predicate == null)
16565 throw new ArgumentNullException("predicate");
16566
16567 return source.Provider.CreateQuery<TSource>(
16568 Expression.Call(
16569 null,
16570 #if CRIPPLED_REFLECTION
16571 InfoOf(() => Qbservable.Where<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, bool>>))),
16572 #else
16573 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16574 #endif
16575 source.Expression,
16576 predicate
16577 )
16578 );
16579 }
16580
16581 /// <summary>
16582 /// Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
16583 /// </summary>
16584 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16585 /// <param name="source">An observable sequence whose elements to filter.</param>
16586 /// <param name="predicate">A function to test each source element for a conditio; the second parameter of the function represents the index of the source element.</param>
16587 /// <returns>An observable sequence that contains elements from the input sequence that satisfy the condition.</returns>
16588 /// <exception cref="T:System.ArgumentNullException">
16589 /// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
16590 public static IQbservable<TSource> Where<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
16591 {
16592 if (source == null)
16593 throw new ArgumentNullException("source");
16594 if (predicate == null)
16595 throw new ArgumentNullException("predicate");
16596
16597 return source.Provider.CreateQuery<TSource>(
16598 Expression.Call(
16599 null,
16600 #if CRIPPLED_REFLECTION
16601 InfoOf(() => Qbservable.Where<TSource>(default(IQbservable<TSource>), default(Expression<Func<TSource, int, bool>>))),
16602 #else
16603 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16604 #endif
16605 source.Expression,
16606 predicate
16607 )
16608 );
16609 }
16610
16611 /// <summary>
16612 /// Repeats the given <paramref name="source" /> as long as the specified <paramref name="condition" /> holds, where the <paramref name="condition" /> is evaluated before each repeated <paramref name="source" /> is subscribed to.
16613 /// </summary>
16614 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
16615 /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
16616 /// <param name="source">Source to repeat as long as the <paramref name="condition" /> function evaluates to true.</param>
16617 /// <param name="condition">Condition that will be evaluated before subscription to the <paramref name="source" />, to determine whether repetition of the source is required.</param>
16618 /// <returns>The observable sequence obtained by concatenating the <paramref name="source" /> sequence as long as the <paramref name="condition" /> holds.</returns>
16619 /// <exception cref="T:System.ArgumentNullException">
16620 /// <paramref name="condition" /> or <paramref name="source" /> is null.</exception>
16621 public static IQbservable<TSource> While<TSource>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TSource> source)
16622 {
16623 if (provider == null)
16624 throw new ArgumentNullException("provider");
16625 if (condition == null)
16626 throw new ArgumentNullException("condition");
16627 if (source == null)
16628 throw new ArgumentNullException("source");
16629
16630 return provider.CreateQuery<TSource>(
16631 Expression.Call(
16632 null,
16633 #if CRIPPLED_REFLECTION
16634 InfoOf(() => Qbservable.While<TSource>(default(IQbservableProvider), default(Expression<Func<bool>>), default(IObservable<TSource>))),
16635 #else
16636 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16637 #endif
16638 Expression.Constant(provider, typeof(IQbservableProvider)),
16639 condition,
16640 GetSourceExpression(source)
16641 )
16642 );
16643 }
16644
16645 /// <summary>
16646 /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on element count information.
16647 /// </summary>
16648 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16649 /// <param name="source">Source sequence to produce windows over.</param>
16650 /// <param name="count">Length of each window.</param>
16651 /// <returns>An observable sequence of windows.</returns>
16652 /// <exception cref="T:System.ArgumentNullException">
16653 /// <paramref name="source" /> is null.</exception>
16654 /// <exception cref="T:System.ArgumentOutOfRangeException">
16655 /// <paramref name="count" /> is less than or equal to zero.</exception>
16656 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count)
16657 {
16658 if (source == null)
16659 throw new ArgumentNullException("source");
16660
16661 return source.Provider.CreateQuery<IObservable<TSource>>(
16662 Expression.Call(
16663 null,
16664 #if CRIPPLED_REFLECTION
16665 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(int))),
16666 #else
16667 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16668 #endif
16669 source.Expression,
16670 Expression.Constant(count, typeof(int))
16671 )
16672 );
16673 }
16674
16675 /// <summary>
16676 /// Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
16677 /// </summary>
16678 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16679 /// <param name="source">Source sequence to produce windows over.</param>
16680 /// <param name="count">Length of each window.</param>
16681 /// <param name="skip">Number of elements to skip between creation of consecutive windows.</param>
16682 /// <returns>An observable sequence of windows.</returns>
16683 /// <exception cref="T:System.ArgumentNullException">
16684 /// <paramref name="source" /> is null.</exception>
16685 /// <exception cref="T:System.ArgumentOutOfRangeException">
16686 /// <paramref name="count" /> or <paramref name="skip" /> is less than or equal to zero.</exception>
16687 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, int count, int skip)
16688 {
16689 if (source == null)
16690 throw new ArgumentNullException("source");
16691
16692 return source.Provider.CreateQuery<IObservable<TSource>>(
16693 Expression.Call(
16694 null,
16695 #if CRIPPLED_REFLECTION
16696 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(int), default(int))),
16697 #else
16698 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16699 #endif
16700 source.Expression,
16701 Expression.Constant(count, typeof(int)),
16702 Expression.Constant(skip, typeof(int))
16703 )
16704 );
16705 }
16706
16707 /// <summary>
16708 /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information.
16709 /// </summary>
16710 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16711 /// <param name="source">Source sequence to produce windows over.</param>
16712 /// <param name="timeSpan">Length of each window.</param>
16713 /// <returns>The sequence of windows.</returns>
16714 /// <exception cref="T:System.ArgumentNullException">
16715 /// <paramref name="source" /> is null.</exception>
16716 /// <exception cref="T:System.ArgumentOutOfRangeException">
16717 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
16718 /// <remarks>
16719 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16720 /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
16721 /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16722 /// </remarks>
16723 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan)
16724 {
16725 if (source == null)
16726 throw new ArgumentNullException("source");
16727
16728 return source.Provider.CreateQuery<IObservable<TSource>>(
16729 Expression.Call(
16730 null,
16731 #if CRIPPLED_REFLECTION
16732 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan))),
16733 #else
16734 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16735 #endif
16736 source.Expression,
16737 Expression.Constant(timeSpan, typeof(TimeSpan))
16738 )
16739 );
16740 }
16741
16742 /// <summary>
16743 /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
16744 /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
16745 /// </summary>
16746 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16747 /// <param name="source">Source sequence to produce windows over.</param>
16748 /// <param name="timeSpan">Maximum time length of a window.</param>
16749 /// <param name="count">Maximum element count of a window.</param>
16750 /// <returns>An observable sequence of windows.</returns>
16751 /// <exception cref="T:System.ArgumentNullException">
16752 /// <paramref name="source" /> is null.</exception>
16753 /// <exception cref="T:System.ArgumentOutOfRangeException">
16754 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
16755 /// <remarks>
16756 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16757 /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
16758 /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16759 /// </remarks>
16760 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count)
16761 {
16762 if (source == null)
16763 throw new ArgumentNullException("source");
16764
16765 return source.Provider.CreateQuery<IObservable<TSource>>(
16766 Expression.Call(
16767 null,
16768 #if CRIPPLED_REFLECTION
16769 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int))),
16770 #else
16771 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16772 #endif
16773 source.Expression,
16774 Expression.Constant(timeSpan, typeof(TimeSpan)),
16775 Expression.Constant(count, typeof(int))
16776 )
16777 );
16778 }
16779
16780 /// <summary>
16781 /// Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.
16782 /// A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.
16783 /// </summary>
16784 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16785 /// <param name="source">Source sequence to produce windows over.</param>
16786 /// <param name="timeSpan">Maximum time length of a window.</param>
16787 /// <param name="count">Maximum element count of a window.</param>
16788 /// <param name="scheduler">Scheduler to run windowing timers on.</param>
16789 /// <returns>An observable sequence of windows.</returns>
16790 /// <exception cref="T:System.ArgumentNullException">
16791 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
16792 /// <exception cref="T:System.ArgumentOutOfRangeException">
16793 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero. -or- <paramref name="count" /> is less than or equal to zero.</exception>
16794 /// <remarks>
16795 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16796 /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
16797 /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16798 /// </remarks>
16799 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, int count, IScheduler scheduler)
16800 {
16801 if (source == null)
16802 throw new ArgumentNullException("source");
16803 if (scheduler == null)
16804 throw new ArgumentNullException("scheduler");
16805
16806 return source.Provider.CreateQuery<IObservable<TSource>>(
16807 Expression.Call(
16808 null,
16809 #if CRIPPLED_REFLECTION
16810 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(int), default(IScheduler))),
16811 #else
16812 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16813 #endif
16814 source.Expression,
16815 Expression.Constant(timeSpan, typeof(TimeSpan)),
16816 Expression.Constant(count, typeof(int)),
16817 Expression.Constant(scheduler, typeof(IScheduler))
16818 )
16819 );
16820 }
16821
16822 /// <summary>
16823 /// Projects each element of an observable sequence into consecutive non-overlapping windows which are produced based on timing information, using the specified scheduler to run timers.
16824 /// </summary>
16825 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16826 /// <param name="source">Source sequence to produce windows over.</param>
16827 /// <param name="timeSpan">Length of each window.</param>
16828 /// <param name="scheduler">Scheduler to run windowing timers on.</param>
16829 /// <returns>An observable sequence of windows.</returns>
16830 /// <exception cref="T:System.ArgumentNullException">
16831 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
16832 /// <exception cref="T:System.ArgumentOutOfRangeException">
16833 /// <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
16834 /// <remarks>
16835 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16836 /// Because all source sequence elements end up in one of the windows, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced
16837 /// by the scheduler, where the action to close the current window and to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16838 /// </remarks>
16839 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, IScheduler scheduler)
16840 {
16841 if (source == null)
16842 throw new ArgumentNullException("source");
16843 if (scheduler == null)
16844 throw new ArgumentNullException("scheduler");
16845
16846 return source.Provider.CreateQuery<IObservable<TSource>>(
16847 Expression.Call(
16848 null,
16849 #if CRIPPLED_REFLECTION
16850 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(IScheduler))),
16851 #else
16852 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16853 #endif
16854 source.Expression,
16855 Expression.Constant(timeSpan, typeof(TimeSpan)),
16856 Expression.Constant(scheduler, typeof(IScheduler))
16857 )
16858 );
16859 }
16860
16861 /// <summary>
16862 /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
16863 /// </summary>
16864 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16865 /// <param name="source">Source sequence to produce windows over.</param>
16866 /// <param name="timeSpan">Length of each window.</param>
16867 /// <param name="timeShift">Interval between creation of consecutive windows.</param>
16868 /// <returns>An observable sequence of windows.</returns>
16869 /// <exception cref="T:System.ArgumentNullException">
16870 /// <paramref name="source" /> is null.</exception>
16871 /// <exception cref="T:System.ArgumentOutOfRangeException">
16872 /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
16873 /// <remarks>
16874 /// <para>
16875 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows with minimum duration
16876 /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
16877 /// current window may not execute immediately, despite the TimeSpan.Zero due time.
16878 /// </para>
16879 /// <para>
16880 /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16881 /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
16882 /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16883 /// </para>
16884 /// </remarks>
16885 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift)
16886 {
16887 if (source == null)
16888 throw new ArgumentNullException("source");
16889
16890 return source.Provider.CreateQuery<IObservable<TSource>>(
16891 Expression.Call(
16892 null,
16893 #if CRIPPLED_REFLECTION
16894 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan))),
16895 #else
16896 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16897 #endif
16898 source.Expression,
16899 Expression.Constant(timeSpan, typeof(TimeSpan)),
16900 Expression.Constant(timeShift, typeof(TimeSpan))
16901 )
16902 );
16903 }
16904
16905 /// <summary>
16906 /// Projects each element of an observable sequence into zero or more windows which are produced based on timing information, using the specified scheduler to run timers.
16907 /// </summary>
16908 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16909 /// <param name="source">Source sequence to produce windows over.</param>
16910 /// <param name="timeSpan">Length of each window.</param>
16911 /// <param name="timeShift">Interval between creation of consecutive windows.</param>
16912 /// <param name="scheduler">Scheduler to run windowing timers on.</param>
16913 /// <returns>An observable sequence of windows.</returns>
16914 /// <exception cref="T:System.ArgumentNullException">
16915 /// <paramref name="source" /> or <paramref name="scheduler" /> is null.</exception>
16916 /// <exception cref="T:System.ArgumentOutOfRangeException">
16917 /// <paramref name="timeSpan" /> or <paramref name="timeSpan" /> is less than TimeSpan.Zero.</exception>
16918 /// <remarks>
16919 /// <para>
16920 /// Specifying a TimeSpan.Zero value for <paramref name="timeSpan" /> is not recommended but supported, causing the scheduler to create windows with minimum duration
16921 /// length. However, some windows won't have a zero time span. This is a side-effect of the asynchrony introduced by the scheduler, where the action to close the
16922 /// current window may not execute immediately, despite the TimeSpan.Zero due time.
16923 /// </para>
16924 /// <para>
16925 /// Specifying a TimeSpan.Zero value for <paramref name="timeShift" /> is not recommended but supported, causing the scheduler to create windows as fast as it can.
16926 /// However, this doesn't mean all windows will start at the beginning of the source sequence. This is a side-effect of the asynchrony introduced by the scheduler,
16927 /// where the action to create a new window may not execute immediately, despite the TimeSpan.Zero due time.
16928 /// </para>
16929 /// </remarks>
16930 public static IQbservable<IObservable<TSource>> Window<TSource>(this IQbservable<TSource> source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler)
16931 {
16932 if (source == null)
16933 throw new ArgumentNullException("source");
16934 if (scheduler == null)
16935 throw new ArgumentNullException("scheduler");
16936
16937 return source.Provider.CreateQuery<IObservable<TSource>>(
16938 Expression.Call(
16939 null,
16940 #if CRIPPLED_REFLECTION
16941 InfoOf(() => Qbservable.Window<TSource>(default(IQbservable<TSource>), default(TimeSpan), default(TimeSpan), default(IScheduler))),
16942 #else
16943 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
16944 #endif
16945 source.Expression,
16946 Expression.Constant(timeSpan, typeof(TimeSpan)),
16947 Expression.Constant(timeShift, typeof(TimeSpan)),
16948 Expression.Constant(scheduler, typeof(IScheduler))
16949 )
16950 );
16951 }
16952
16953 /// <summary>
16954 /// Projects each element of an observable sequence into consecutive non-overlapping windows.
16955 /// </summary>
16956 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16957 /// <typeparam name="TWindowBoundary">The type of the elements in the sequences indicating window boundary events.</typeparam>
16958 /// <param name="source">Source sequence to produce windows over.</param>
16959 /// <param name="windowBoundaries">Sequence of window boundary markers. The current window is closed and a new window is opened upon receiving a boundary marker.</param>
16960 /// <returns>An observable sequence of windows.</returns>
16961 /// <exception cref="T:System.ArgumentNullException">
16962 /// <paramref name="source" /> or <paramref name="windowBoundaries" /> is null.</exception>
16963 public static IQbservable<IObservable<TSource>> Window<TSource, TWindowBoundary>(this IQbservable<TSource> source, IObservable<TWindowBoundary> windowBoundaries)
16964 {
16965 if (source == null)
16966 throw new ArgumentNullException("source");
16967 if (windowBoundaries == null)
16968 throw new ArgumentNullException("windowBoundaries");
16969
16970 return source.Provider.CreateQuery<IObservable<TSource>>(
16971 Expression.Call(
16972 null,
16973 #if CRIPPLED_REFLECTION
16974 InfoOf(() => Qbservable.Window<TSource, TWindowBoundary>(default(IQbservable<TSource>), default(IObservable<TWindowBoundary>))),
16975 #else
16976 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowBoundary)),
16977 #endif
16978 source.Expression,
16979 GetSourceExpression(windowBoundaries)
16980 )
16981 );
16982 }
16983
16984 /// <summary>
16985 /// Projects each element of an observable sequence into consecutive non-overlapping windows.
16986 /// </summary>
16987 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
16988 /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
16989 /// <param name="source">Source sequence to produce windows over.</param>
16990 /// <param name="windowClosingSelector">A function invoked to define the boundaries of the produced windows. A new window is started when the previous one is closed.</param>
16991 /// <returns>An observable sequence of windows.</returns>
16992 /// <exception cref="T:System.ArgumentNullException">
16993 /// <paramref name="source" /> or <paramref name="windowClosingSelector" /> is null.</exception>
16994 public static IQbservable<IObservable<TSource>> Window<TSource, TWindowClosing>(this IQbservable<TSource> source, Expression<Func<IObservable<TWindowClosing>>> windowClosingSelector)
16995 {
16996 if (source == null)
16997 throw new ArgumentNullException("source");
16998 if (windowClosingSelector == null)
16999 throw new ArgumentNullException("windowClosingSelector");
17000
17001 return source.Provider.CreateQuery<IObservable<TSource>>(
17002 Expression.Call(
17003 null,
17004 #if CRIPPLED_REFLECTION
17005 InfoOf(() => Qbservable.Window<TSource, TWindowClosing>(default(IQbservable<TSource>), default(Expression<Func<IObservable<TWindowClosing>>>))),
17006 #else
17007 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowClosing)),
17008 #endif
17009 source.Expression,
17010 windowClosingSelector
17011 )
17012 );
17013 }
17014
17015 /// <summary>
17016 /// Projects each element of an observable sequence into zero or more windows.
17017 /// </summary>
17018 /// <typeparam name="TSource">The type of the elements in the source sequence, and in the windows in the result sequence.</typeparam>
17019 /// <typeparam name="TWindowOpening">The type of the elements in the sequence indicating window opening events, also passed to the closing selector to obtain a sequence of window closing events.</typeparam>
17020 /// <typeparam name="TWindowClosing">The type of the elements in the sequences indicating window closing events.</typeparam>
17021 /// <param name="source">Source sequence to produce windows over.</param>
17022 /// <param name="windowOpenings">Observable sequence whose elements denote the creation of new windows.</param>
17023 /// <param name="windowClosingSelector">A function invoked to define the closing of each produced window.</param>
17024 /// <returns>An observable sequence of windows.</returns>
17025 /// <exception cref="T:System.ArgumentNullException">
17026 /// <paramref name="source" /> or <paramref name="windowOpenings" /> or <paramref name="windowClosingSelector" /> is null.</exception>
17027 public static IQbservable<IObservable<TSource>> Window<TSource, TWindowOpening, TWindowClosing>(this IQbservable<TSource> source, IObservable<TWindowOpening> windowOpenings, Expression<Func<TWindowOpening, IObservable<TWindowClosing>>> windowClosingSelector)
17028 {
17029 if (source == null)
17030 throw new ArgumentNullException("source");
17031 if (windowOpenings == null)
17032 throw new ArgumentNullException("windowOpenings");
17033 if (windowClosingSelector == null)
17034 throw new ArgumentNullException("windowClosingSelector");
17035
17036 return source.Provider.CreateQuery<IObservable<TSource>>(
17037 Expression.Call(
17038 null,
17039 #if CRIPPLED_REFLECTION
17040 InfoOf(() => Qbservable.Window<TSource, TWindowOpening, TWindowClosing>(default(IQbservable<TSource>), default(IObservable<TWindowOpening>), default(Expression<Func<TWindowOpening, IObservable<TWindowClosing>>>))),
17041 #else
17042 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TWindowOpening), typeof(TWindowClosing)),
17043 #endif
17044 source.Expression,
17045 GetSourceExpression(windowOpenings),
17046 windowClosingSelector
17047 )
17048 );
17049 }
17050
17051 /// <summary>
17052 /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
17053 /// </summary>
17054 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
17055 /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
17056 /// <param name="sources">Observable sources.</param>
17057 /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
17058 /// <exception cref="T:System.ArgumentNullException">
17059 /// <paramref name="sources" /> is null.</exception>
17060 public static IQbservable<IList<TSource>> Zip<TSource>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources)
17061 {
17062 if (provider == null)
17063 throw new ArgumentNullException("provider");
17064 if (sources == null)
17065 throw new ArgumentNullException("sources");
17066
17067 return provider.CreateQuery<IList<TSource>>(
17068 Expression.Call(
17069 null,
17070 #if CRIPPLED_REFLECTION
17071 InfoOf(() => Qbservable.Zip<TSource>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>))),
17072 #else
17073 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
17074 #endif
17075 Expression.Constant(provider, typeof(IQbservableProvider)),
17076 GetSourceExpression(sources)
17077 )
17078 );
17079 }
17080
17081 /// <summary>
17082 /// Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
17083 /// </summary>
17084 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
17085 /// <typeparam name="TSource">The type of the elements in the source sequences, and in the lists in the result sequence.</typeparam>
17086 /// <param name="sources">Observable sources.</param>
17087 /// <returns>An observable sequence containing lists of elements at corresponding indexes.</returns>
17088 /// <exception cref="T:System.ArgumentNullException">
17089 /// <paramref name="sources" /> is null.</exception>
17090 public static IQbservable<IList<TSource>> Zip<TSource>(this IQbservableProvider provider, params IObservable<TSource>[] sources)
17091 {
17092 if (provider == null)
17093 throw new ArgumentNullException("provider");
17094 if (sources == null)
17095 throw new ArgumentNullException("sources");
17096
17097 return provider.CreateQuery<IList<TSource>>(
17098 Expression.Call(
17099 null,
17100 #if CRIPPLED_REFLECTION
17101 InfoOf(() => Qbservable.Zip<TSource>(default(IQbservableProvider), default(IObservable<TSource>[]))),
17102 #else
17103 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)),
17104 #endif
17105 Expression.Constant(provider, typeof(IQbservableProvider)),
17106 GetSourceExpression(sources)
17107 )
17108 );
17109 }
17110
17111 /// <summary>
17112 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17113 /// </summary>
17114 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
17115 /// <typeparam name="TSource">The type of the elements in the source sequences.</typeparam>
17116 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17117 /// <param name="sources">Observable sources.</param>
17118 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17119 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17120 /// <exception cref="T:System.ArgumentNullException">
17121 /// <paramref name="sources" /> or <paramref name="resultSelector" /> is null.</exception>
17122 public static IQbservable<TResult> Zip<TSource, TResult>(this IQbservableProvider provider, IEnumerable<IObservable<TSource>> sources, Expression<Func<IList<TSource>, TResult>> resultSelector)
17123 {
17124 if (provider == null)
17125 throw new ArgumentNullException("provider");
17126 if (sources == null)
17127 throw new ArgumentNullException("sources");
17128 if (resultSelector == null)
17129 throw new ArgumentNullException("resultSelector");
17130
17131 return provider.CreateQuery<TResult>(
17132 Expression.Call(
17133 null,
17134 #if CRIPPLED_REFLECTION
17135 InfoOf(() => Qbservable.Zip<TSource, TResult>(default(IQbservableProvider), default(IEnumerable<IObservable<TSource>>), default(Expression<Func<IList<TSource>, TResult>>))),
17136 #else
17137 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)),
17138 #endif
17139 Expression.Constant(provider, typeof(IQbservableProvider)),
17140 GetSourceExpression(sources),
17141 resultSelector
17142 )
17143 );
17144 }
17145
17146 /// <summary>
17147 /// Merges an observable sequence and an enumerable sequence into one observable sequence by using the selector function.
17148 /// </summary>
17149 /// <typeparam name="TSource1">The type of the elements in the first observable source sequence.</typeparam>
17150 /// <typeparam name="TSource2">The type of the elements in the second enumerable source sequence.</typeparam>
17151 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17152 /// <param name="first">First observable source.</param>
17153 /// <param name="second">Second enumerable source.</param>
17154 /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
17155 /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
17156 /// <exception cref="T:System.ArgumentNullException">
17157 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
17158 public static IQbservable<TResult> Zip<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IEnumerable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
17159 {
17160 if (first == null)
17161 throw new ArgumentNullException("first");
17162 if (second == null)
17163 throw new ArgumentNullException("second");
17164 if (resultSelector == null)
17165 throw new ArgumentNullException("resultSelector");
17166
17167 return first.Provider.CreateQuery<TResult>(
17168 Expression.Call(
17169 null,
17170 #if CRIPPLED_REFLECTION
17171 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IEnumerable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
17172 #else
17173 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
17174 #endif
17175 first.Expression,
17176 GetSourceExpression(second),
17177 resultSelector
17178 )
17179 );
17180 }
17181
17182 /// <summary>
17183 /// Merges two observable sequences into one observable sequence by combining their elements in a pairwise fashion.
17184 /// </summary>
17185 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17186 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17187 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17188 /// <param name="first">First observable source.</param>
17189 /// <param name="second">Second observable source.</param>
17190 /// <param name="resultSelector">Function to invoke for each consecutive pair of elements from the first and second source.</param>
17191 /// <returns>An observable sequence containing the result of pairwise combining the elements of the first and second source using the specified result selector function.</returns>
17192 /// <exception cref="T:System.ArgumentNullException">
17193 /// <paramref name="first" /> or <paramref name="second" /> or <paramref name="resultSelector" /> is null.</exception>
17194 public static IQbservable<TResult> Zip<TSource1, TSource2, TResult>(this IQbservable<TSource1> first, IObservable<TSource2> second, Expression<Func<TSource1, TSource2, TResult>> resultSelector)
17195 {
17196 if (first == null)
17197 throw new ArgumentNullException("first");
17198 if (second == null)
17199 throw new ArgumentNullException("second");
17200 if (resultSelector == null)
17201 throw new ArgumentNullException("resultSelector");
17202
17203 return first.Provider.CreateQuery<TResult>(
17204 Expression.Call(
17205 null,
17206 #if CRIPPLED_REFLECTION
17207 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(Expression<Func<TSource1, TSource2, TResult>>))),
17208 #else
17209 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TResult)),
17210 #endif
17211 first.Expression,
17212 GetSourceExpression(second),
17213 resultSelector
17214 )
17215 );
17216 }
17217
17218 /// <summary>
17219 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17220 /// </summary>
17221 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17222 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17223 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17224 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17225 /// <param name="source1">First observable source.</param>
17226 /// <param name="source2">Second observable source.</param>
17227 /// <param name="source3">Third observable source.</param>
17228 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17229 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17230 /// <exception cref="T:System.ArgumentNullException">
17231 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="resultSelector" /> is null.</exception>
17232 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, Expression<Func<TSource1, TSource2, TSource3, TResult>> resultSelector)
17233 {
17234 if (source1 == null)
17235 throw new ArgumentNullException("source1");
17236 if (source2 == null)
17237 throw new ArgumentNullException("source2");
17238 if (source3 == null)
17239 throw new ArgumentNullException("source3");
17240 if (resultSelector == null)
17241 throw new ArgumentNullException("resultSelector");
17242
17243 return source1.Provider.CreateQuery<TResult>(
17244 Expression.Call(
17245 null,
17246 #if CRIPPLED_REFLECTION
17247 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(Expression<Func<TSource1, TSource2, TSource3, TResult>>))),
17248 #else
17249 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TResult)),
17250 #endif
17251 source1.Expression,
17252 GetSourceExpression(source2),
17253 GetSourceExpression(source3),
17254 resultSelector
17255 )
17256 );
17257 }
17258
17259 /// <summary>
17260 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17261 /// </summary>
17262 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17263 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17264 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17265 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17266 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17267 /// <param name="source1">First observable source.</param>
17268 /// <param name="source2">Second observable source.</param>
17269 /// <param name="source3">Third observable source.</param>
17270 /// <param name="source4">Fourth observable source.</param>
17271 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17272 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17273 /// <exception cref="T:System.ArgumentNullException">
17274 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="resultSelector" /> is null.</exception>
17275 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>> resultSelector)
17276 {
17277 if (source1 == null)
17278 throw new ArgumentNullException("source1");
17279 if (source2 == null)
17280 throw new ArgumentNullException("source2");
17281 if (source3 == null)
17282 throw new ArgumentNullException("source3");
17283 if (source4 == null)
17284 throw new ArgumentNullException("source4");
17285 if (resultSelector == null)
17286 throw new ArgumentNullException("resultSelector");
17287
17288 return source1.Provider.CreateQuery<TResult>(
17289 Expression.Call(
17290 null,
17291 #if CRIPPLED_REFLECTION
17292 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TResult>>))),
17293 #else
17294 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TResult)),
17295 #endif
17296 source1.Expression,
17297 GetSourceExpression(source2),
17298 GetSourceExpression(source3),
17299 GetSourceExpression(source4),
17300 resultSelector
17301 )
17302 );
17303 }
17304
17305 #if !NO_LARGEARITY
17306 /// <summary>
17307 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17308 /// </summary>
17309 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17310 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17311 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17312 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17313 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17314 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17315 /// <param name="source1">First observable source.</param>
17316 /// <param name="source2">Second observable source.</param>
17317 /// <param name="source3">Third observable source.</param>
17318 /// <param name="source4">Fourth observable source.</param>
17319 /// <param name="source5">Fifth observable source.</param>
17320 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17321 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17322 /// <exception cref="T:System.ArgumentNullException">
17323 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="resultSelector" /> is null.</exception>
17324 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>> resultSelector)
17325 {
17326 if (source1 == null)
17327 throw new ArgumentNullException("source1");
17328 if (source2 == null)
17329 throw new ArgumentNullException("source2");
17330 if (source3 == null)
17331 throw new ArgumentNullException("source3");
17332 if (source4 == null)
17333 throw new ArgumentNullException("source4");
17334 if (source5 == null)
17335 throw new ArgumentNullException("source5");
17336 if (resultSelector == null)
17337 throw new ArgumentNullException("resultSelector");
17338
17339 return source1.Provider.CreateQuery<TResult>(
17340 Expression.Call(
17341 null,
17342 #if CRIPPLED_REFLECTION
17343 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TResult>>))),
17344 #else
17345 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TResult)),
17346 #endif
17347 source1.Expression,
17348 GetSourceExpression(source2),
17349 GetSourceExpression(source3),
17350 GetSourceExpression(source4),
17351 GetSourceExpression(source5),
17352 resultSelector
17353 )
17354 );
17355 }
17356 #endif
17357
17358 #if !NO_LARGEARITY
17359 /// <summary>
17360 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17361 /// </summary>
17362 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17363 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17364 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17365 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17366 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17367 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17368 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17369 /// <param name="source1">First observable source.</param>
17370 /// <param name="source2">Second observable source.</param>
17371 /// <param name="source3">Third observable source.</param>
17372 /// <param name="source4">Fourth observable source.</param>
17373 /// <param name="source5">Fifth observable source.</param>
17374 /// <param name="source6">Sixth observable source.</param>
17375 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17376 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17377 /// <exception cref="T:System.ArgumentNullException">
17378 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="resultSelector" /> is null.</exception>
17379 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>> resultSelector)
17380 {
17381 if (source1 == null)
17382 throw new ArgumentNullException("source1");
17383 if (source2 == null)
17384 throw new ArgumentNullException("source2");
17385 if (source3 == null)
17386 throw new ArgumentNullException("source3");
17387 if (source4 == null)
17388 throw new ArgumentNullException("source4");
17389 if (source5 == null)
17390 throw new ArgumentNullException("source5");
17391 if (source6 == null)
17392 throw new ArgumentNullException("source6");
17393 if (resultSelector == null)
17394 throw new ArgumentNullException("resultSelector");
17395
17396 return source1.Provider.CreateQuery<TResult>(
17397 Expression.Call(
17398 null,
17399 #if CRIPPLED_REFLECTION
17400 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TResult>>))),
17401 #else
17402 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TResult)),
17403 #endif
17404 source1.Expression,
17405 GetSourceExpression(source2),
17406 GetSourceExpression(source3),
17407 GetSourceExpression(source4),
17408 GetSourceExpression(source5),
17409 GetSourceExpression(source6),
17410 resultSelector
17411 )
17412 );
17413 }
17414 #endif
17415
17416 #if !NO_LARGEARITY
17417 /// <summary>
17418 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17419 /// </summary>
17420 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17421 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17422 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17423 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17424 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17425 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17426 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17427 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17428 /// <param name="source1">First observable source.</param>
17429 /// <param name="source2">Second observable source.</param>
17430 /// <param name="source3">Third observable source.</param>
17431 /// <param name="source4">Fourth observable source.</param>
17432 /// <param name="source5">Fifth observable source.</param>
17433 /// <param name="source6">Sixth observable source.</param>
17434 /// <param name="source7">Seventh observable source.</param>
17435 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17436 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17437 /// <exception cref="T:System.ArgumentNullException">
17438 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="resultSelector" /> is null.</exception>
17439 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>> resultSelector)
17440 {
17441 if (source1 == null)
17442 throw new ArgumentNullException("source1");
17443 if (source2 == null)
17444 throw new ArgumentNullException("source2");
17445 if (source3 == null)
17446 throw new ArgumentNullException("source3");
17447 if (source4 == null)
17448 throw new ArgumentNullException("source4");
17449 if (source5 == null)
17450 throw new ArgumentNullException("source5");
17451 if (source6 == null)
17452 throw new ArgumentNullException("source6");
17453 if (source7 == null)
17454 throw new ArgumentNullException("source7");
17455 if (resultSelector == null)
17456 throw new ArgumentNullException("resultSelector");
17457
17458 return source1.Provider.CreateQuery<TResult>(
17459 Expression.Call(
17460 null,
17461 #if CRIPPLED_REFLECTION
17462 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TResult>>))),
17463 #else
17464 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TResult)),
17465 #endif
17466 source1.Expression,
17467 GetSourceExpression(source2),
17468 GetSourceExpression(source3),
17469 GetSourceExpression(source4),
17470 GetSourceExpression(source5),
17471 GetSourceExpression(source6),
17472 GetSourceExpression(source7),
17473 resultSelector
17474 )
17475 );
17476 }
17477 #endif
17478
17479 #if !NO_LARGEARITY
17480 /// <summary>
17481 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17482 /// </summary>
17483 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17484 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17485 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17486 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17487 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17488 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17489 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17490 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17491 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17492 /// <param name="source1">First observable source.</param>
17493 /// <param name="source2">Second observable source.</param>
17494 /// <param name="source3">Third observable source.</param>
17495 /// <param name="source4">Fourth observable source.</param>
17496 /// <param name="source5">Fifth observable source.</param>
17497 /// <param name="source6">Sixth observable source.</param>
17498 /// <param name="source7">Seventh observable source.</param>
17499 /// <param name="source8">Eighth observable source.</param>
17500 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17501 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17502 /// <exception cref="T:System.ArgumentNullException">
17503 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="resultSelector" /> is null.</exception>
17504 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>> resultSelector)
17505 {
17506 if (source1 == null)
17507 throw new ArgumentNullException("source1");
17508 if (source2 == null)
17509 throw new ArgumentNullException("source2");
17510 if (source3 == null)
17511 throw new ArgumentNullException("source3");
17512 if (source4 == null)
17513 throw new ArgumentNullException("source4");
17514 if (source5 == null)
17515 throw new ArgumentNullException("source5");
17516 if (source6 == null)
17517 throw new ArgumentNullException("source6");
17518 if (source7 == null)
17519 throw new ArgumentNullException("source7");
17520 if (source8 == null)
17521 throw new ArgumentNullException("source8");
17522 if (resultSelector == null)
17523 throw new ArgumentNullException("resultSelector");
17524
17525 return source1.Provider.CreateQuery<TResult>(
17526 Expression.Call(
17527 null,
17528 #if CRIPPLED_REFLECTION
17529 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TResult>>))),
17530 #else
17531 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TResult)),
17532 #endif
17533 source1.Expression,
17534 GetSourceExpression(source2),
17535 GetSourceExpression(source3),
17536 GetSourceExpression(source4),
17537 GetSourceExpression(source5),
17538 GetSourceExpression(source6),
17539 GetSourceExpression(source7),
17540 GetSourceExpression(source8),
17541 resultSelector
17542 )
17543 );
17544 }
17545 #endif
17546
17547 #if !NO_LARGEARITY
17548 /// <summary>
17549 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17550 /// </summary>
17551 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17552 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17553 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17554 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17555 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17556 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17557 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17558 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17559 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17560 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17561 /// <param name="source1">First observable source.</param>
17562 /// <param name="source2">Second observable source.</param>
17563 /// <param name="source3">Third observable source.</param>
17564 /// <param name="source4">Fourth observable source.</param>
17565 /// <param name="source5">Fifth observable source.</param>
17566 /// <param name="source6">Sixth observable source.</param>
17567 /// <param name="source7">Seventh observable source.</param>
17568 /// <param name="source8">Eighth observable source.</param>
17569 /// <param name="source9">Ninth observable source.</param>
17570 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17571 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17572 /// <exception cref="T:System.ArgumentNullException">
17573 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="resultSelector" /> is null.</exception>
17574 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>> resultSelector)
17575 {
17576 if (source1 == null)
17577 throw new ArgumentNullException("source1");
17578 if (source2 == null)
17579 throw new ArgumentNullException("source2");
17580 if (source3 == null)
17581 throw new ArgumentNullException("source3");
17582 if (source4 == null)
17583 throw new ArgumentNullException("source4");
17584 if (source5 == null)
17585 throw new ArgumentNullException("source5");
17586 if (source6 == null)
17587 throw new ArgumentNullException("source6");
17588 if (source7 == null)
17589 throw new ArgumentNullException("source7");
17590 if (source8 == null)
17591 throw new ArgumentNullException("source8");
17592 if (source9 == null)
17593 throw new ArgumentNullException("source9");
17594 if (resultSelector == null)
17595 throw new ArgumentNullException("resultSelector");
17596
17597 return source1.Provider.CreateQuery<TResult>(
17598 Expression.Call(
17599 null,
17600 #if CRIPPLED_REFLECTION
17601 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TResult>>))),
17602 #else
17603 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TResult)),
17604 #endif
17605 source1.Expression,
17606 GetSourceExpression(source2),
17607 GetSourceExpression(source3),
17608 GetSourceExpression(source4),
17609 GetSourceExpression(source5),
17610 GetSourceExpression(source6),
17611 GetSourceExpression(source7),
17612 GetSourceExpression(source8),
17613 GetSourceExpression(source9),
17614 resultSelector
17615 )
17616 );
17617 }
17618 #endif
17619
17620 #if !NO_LARGEARITY
17621 /// <summary>
17622 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17623 /// </summary>
17624 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17625 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17626 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17627 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17628 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17629 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17630 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17631 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17632 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17633 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
17634 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17635 /// <param name="source1">First observable source.</param>
17636 /// <param name="source2">Second observable source.</param>
17637 /// <param name="source3">Third observable source.</param>
17638 /// <param name="source4">Fourth observable source.</param>
17639 /// <param name="source5">Fifth observable source.</param>
17640 /// <param name="source6">Sixth observable source.</param>
17641 /// <param name="source7">Seventh observable source.</param>
17642 /// <param name="source8">Eighth observable source.</param>
17643 /// <param name="source9">Ninth observable source.</param>
17644 /// <param name="source10">Tenth observable source.</param>
17645 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17646 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17647 /// <exception cref="T:System.ArgumentNullException">
17648 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="resultSelector" /> is null.</exception>
17649 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>> resultSelector)
17650 {
17651 if (source1 == null)
17652 throw new ArgumentNullException("source1");
17653 if (source2 == null)
17654 throw new ArgumentNullException("source2");
17655 if (source3 == null)
17656 throw new ArgumentNullException("source3");
17657 if (source4 == null)
17658 throw new ArgumentNullException("source4");
17659 if (source5 == null)
17660 throw new ArgumentNullException("source5");
17661 if (source6 == null)
17662 throw new ArgumentNullException("source6");
17663 if (source7 == null)
17664 throw new ArgumentNullException("source7");
17665 if (source8 == null)
17666 throw new ArgumentNullException("source8");
17667 if (source9 == null)
17668 throw new ArgumentNullException("source9");
17669 if (source10 == null)
17670 throw new ArgumentNullException("source10");
17671 if (resultSelector == null)
17672 throw new ArgumentNullException("resultSelector");
17673
17674 return source1.Provider.CreateQuery<TResult>(
17675 Expression.Call(
17676 null,
17677 #if CRIPPLED_REFLECTION
17678 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TResult>>))),
17679 #else
17680 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TResult)),
17681 #endif
17682 source1.Expression,
17683 GetSourceExpression(source2),
17684 GetSourceExpression(source3),
17685 GetSourceExpression(source4),
17686 GetSourceExpression(source5),
17687 GetSourceExpression(source6),
17688 GetSourceExpression(source7),
17689 GetSourceExpression(source8),
17690 GetSourceExpression(source9),
17691 GetSourceExpression(source10),
17692 resultSelector
17693 )
17694 );
17695 }
17696 #endif
17697
17698 #if !NO_LARGEARITY
17699 /// <summary>
17700 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17701 /// </summary>
17702 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17703 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17704 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17705 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17706 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17707 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17708 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17709 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17710 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17711 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
17712 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
17713 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17714 /// <param name="source1">First observable source.</param>
17715 /// <param name="source2">Second observable source.</param>
17716 /// <param name="source3">Third observable source.</param>
17717 /// <param name="source4">Fourth observable source.</param>
17718 /// <param name="source5">Fifth observable source.</param>
17719 /// <param name="source6">Sixth observable source.</param>
17720 /// <param name="source7">Seventh observable source.</param>
17721 /// <param name="source8">Eighth observable source.</param>
17722 /// <param name="source9">Ninth observable source.</param>
17723 /// <param name="source10">Tenth observable source.</param>
17724 /// <param name="source11">Eleventh observable source.</param>
17725 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17726 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17727 /// <exception cref="T:System.ArgumentNullException">
17728 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="resultSelector" /> is null.</exception>
17729 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>> resultSelector)
17730 {
17731 if (source1 == null)
17732 throw new ArgumentNullException("source1");
17733 if (source2 == null)
17734 throw new ArgumentNullException("source2");
17735 if (source3 == null)
17736 throw new ArgumentNullException("source3");
17737 if (source4 == null)
17738 throw new ArgumentNullException("source4");
17739 if (source5 == null)
17740 throw new ArgumentNullException("source5");
17741 if (source6 == null)
17742 throw new ArgumentNullException("source6");
17743 if (source7 == null)
17744 throw new ArgumentNullException("source7");
17745 if (source8 == null)
17746 throw new ArgumentNullException("source8");
17747 if (source9 == null)
17748 throw new ArgumentNullException("source9");
17749 if (source10 == null)
17750 throw new ArgumentNullException("source10");
17751 if (source11 == null)
17752 throw new ArgumentNullException("source11");
17753 if (resultSelector == null)
17754 throw new ArgumentNullException("resultSelector");
17755
17756 return source1.Provider.CreateQuery<TResult>(
17757 Expression.Call(
17758 null,
17759 #if CRIPPLED_REFLECTION
17760 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TResult>>))),
17761 #else
17762 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TResult)),
17763 #endif
17764 source1.Expression,
17765 GetSourceExpression(source2),
17766 GetSourceExpression(source3),
17767 GetSourceExpression(source4),
17768 GetSourceExpression(source5),
17769 GetSourceExpression(source6),
17770 GetSourceExpression(source7),
17771 GetSourceExpression(source8),
17772 GetSourceExpression(source9),
17773 GetSourceExpression(source10),
17774 GetSourceExpression(source11),
17775 resultSelector
17776 )
17777 );
17778 }
17779 #endif
17780
17781 #if !NO_LARGEARITY
17782 /// <summary>
17783 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17784 /// </summary>
17785 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17786 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17787 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17788 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17789 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17790 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17791 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17792 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17793 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17794 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
17795 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
17796 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
17797 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17798 /// <param name="source1">First observable source.</param>
17799 /// <param name="source2">Second observable source.</param>
17800 /// <param name="source3">Third observable source.</param>
17801 /// <param name="source4">Fourth observable source.</param>
17802 /// <param name="source5">Fifth observable source.</param>
17803 /// <param name="source6">Sixth observable source.</param>
17804 /// <param name="source7">Seventh observable source.</param>
17805 /// <param name="source8">Eighth observable source.</param>
17806 /// <param name="source9">Ninth observable source.</param>
17807 /// <param name="source10">Tenth observable source.</param>
17808 /// <param name="source11">Eleventh observable source.</param>
17809 /// <param name="source12">Twelfth observable source.</param>
17810 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17811 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17812 /// <exception cref="T:System.ArgumentNullException">
17813 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="resultSelector" /> is null.</exception>
17814 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>> resultSelector)
17815 {
17816 if (source1 == null)
17817 throw new ArgumentNullException("source1");
17818 if (source2 == null)
17819 throw new ArgumentNullException("source2");
17820 if (source3 == null)
17821 throw new ArgumentNullException("source3");
17822 if (source4 == null)
17823 throw new ArgumentNullException("source4");
17824 if (source5 == null)
17825 throw new ArgumentNullException("source5");
17826 if (source6 == null)
17827 throw new ArgumentNullException("source6");
17828 if (source7 == null)
17829 throw new ArgumentNullException("source7");
17830 if (source8 == null)
17831 throw new ArgumentNullException("source8");
17832 if (source9 == null)
17833 throw new ArgumentNullException("source9");
17834 if (source10 == null)
17835 throw new ArgumentNullException("source10");
17836 if (source11 == null)
17837 throw new ArgumentNullException("source11");
17838 if (source12 == null)
17839 throw new ArgumentNullException("source12");
17840 if (resultSelector == null)
17841 throw new ArgumentNullException("resultSelector");
17842
17843 return source1.Provider.CreateQuery<TResult>(
17844 Expression.Call(
17845 null,
17846 #if CRIPPLED_REFLECTION
17847 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TResult>>))),
17848 #else
17849 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TResult)),
17850 #endif
17851 source1.Expression,
17852 GetSourceExpression(source2),
17853 GetSourceExpression(source3),
17854 GetSourceExpression(source4),
17855 GetSourceExpression(source5),
17856 GetSourceExpression(source6),
17857 GetSourceExpression(source7),
17858 GetSourceExpression(source8),
17859 GetSourceExpression(source9),
17860 GetSourceExpression(source10),
17861 GetSourceExpression(source11),
17862 GetSourceExpression(source12),
17863 resultSelector
17864 )
17865 );
17866 }
17867 #endif
17868
17869 #if !NO_LARGEARITY
17870 /// <summary>
17871 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17872 /// </summary>
17873 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17874 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17875 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17876 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17877 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17878 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17879 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17880 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17881 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17882 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
17883 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
17884 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
17885 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
17886 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17887 /// <param name="source1">First observable source.</param>
17888 /// <param name="source2">Second observable source.</param>
17889 /// <param name="source3">Third observable source.</param>
17890 /// <param name="source4">Fourth observable source.</param>
17891 /// <param name="source5">Fifth observable source.</param>
17892 /// <param name="source6">Sixth observable source.</param>
17893 /// <param name="source7">Seventh observable source.</param>
17894 /// <param name="source8">Eighth observable source.</param>
17895 /// <param name="source9">Ninth observable source.</param>
17896 /// <param name="source10">Tenth observable source.</param>
17897 /// <param name="source11">Eleventh observable source.</param>
17898 /// <param name="source12">Twelfth observable source.</param>
17899 /// <param name="source13">Thirteenth observable source.</param>
17900 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17901 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17902 /// <exception cref="T:System.ArgumentNullException">
17903 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="resultSelector" /> is null.</exception>
17904 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>> resultSelector)
17905 {
17906 if (source1 == null)
17907 throw new ArgumentNullException("source1");
17908 if (source2 == null)
17909 throw new ArgumentNullException("source2");
17910 if (source3 == null)
17911 throw new ArgumentNullException("source3");
17912 if (source4 == null)
17913 throw new ArgumentNullException("source4");
17914 if (source5 == null)
17915 throw new ArgumentNullException("source5");
17916 if (source6 == null)
17917 throw new ArgumentNullException("source6");
17918 if (source7 == null)
17919 throw new ArgumentNullException("source7");
17920 if (source8 == null)
17921 throw new ArgumentNullException("source8");
17922 if (source9 == null)
17923 throw new ArgumentNullException("source9");
17924 if (source10 == null)
17925 throw new ArgumentNullException("source10");
17926 if (source11 == null)
17927 throw new ArgumentNullException("source11");
17928 if (source12 == null)
17929 throw new ArgumentNullException("source12");
17930 if (source13 == null)
17931 throw new ArgumentNullException("source13");
17932 if (resultSelector == null)
17933 throw new ArgumentNullException("resultSelector");
17934
17935 return source1.Provider.CreateQuery<TResult>(
17936 Expression.Call(
17937 null,
17938 #if CRIPPLED_REFLECTION
17939 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TResult>>))),
17940 #else
17941 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TResult)),
17942 #endif
17943 source1.Expression,
17944 GetSourceExpression(source2),
17945 GetSourceExpression(source3),
17946 GetSourceExpression(source4),
17947 GetSourceExpression(source5),
17948 GetSourceExpression(source6),
17949 GetSourceExpression(source7),
17950 GetSourceExpression(source8),
17951 GetSourceExpression(source9),
17952 GetSourceExpression(source10),
17953 GetSourceExpression(source11),
17954 GetSourceExpression(source12),
17955 GetSourceExpression(source13),
17956 resultSelector
17957 )
17958 );
17959 }
17960 #endif
17961
17962 #if !NO_LARGEARITY
17963 /// <summary>
17964 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
17965 /// </summary>
17966 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
17967 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
17968 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
17969 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
17970 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
17971 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
17972 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
17973 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
17974 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
17975 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
17976 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
17977 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
17978 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
17979 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
17980 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
17981 /// <param name="source1">First observable source.</param>
17982 /// <param name="source2">Second observable source.</param>
17983 /// <param name="source3">Third observable source.</param>
17984 /// <param name="source4">Fourth observable source.</param>
17985 /// <param name="source5">Fifth observable source.</param>
17986 /// <param name="source6">Sixth observable source.</param>
17987 /// <param name="source7">Seventh observable source.</param>
17988 /// <param name="source8">Eighth observable source.</param>
17989 /// <param name="source9">Ninth observable source.</param>
17990 /// <param name="source10">Tenth observable source.</param>
17991 /// <param name="source11">Eleventh observable source.</param>
17992 /// <param name="source12">Twelfth observable source.</param>
17993 /// <param name="source13">Thirteenth observable source.</param>
17994 /// <param name="source14">Fourteenth observable source.</param>
17995 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
17996 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
17997 /// <exception cref="T:System.ArgumentNullException">
17998 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="resultSelector" /> is null.</exception>
17999 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>> resultSelector)
18000 {
18001 if (source1 == null)
18002 throw new ArgumentNullException("source1");
18003 if (source2 == null)
18004 throw new ArgumentNullException("source2");
18005 if (source3 == null)
18006 throw new ArgumentNullException("source3");
18007 if (source4 == null)
18008 throw new ArgumentNullException("source4");
18009 if (source5 == null)
18010 throw new ArgumentNullException("source5");
18011 if (source6 == null)
18012 throw new ArgumentNullException("source6");
18013 if (source7 == null)
18014 throw new ArgumentNullException("source7");
18015 if (source8 == null)
18016 throw new ArgumentNullException("source8");
18017 if (source9 == null)
18018 throw new ArgumentNullException("source9");
18019 if (source10 == null)
18020 throw new ArgumentNullException("source10");
18021 if (source11 == null)
18022 throw new ArgumentNullException("source11");
18023 if (source12 == null)
18024 throw new ArgumentNullException("source12");
18025 if (source13 == null)
18026 throw new ArgumentNullException("source13");
18027 if (source14 == null)
18028 throw new ArgumentNullException("source14");
18029 if (resultSelector == null)
18030 throw new ArgumentNullException("resultSelector");
18031
18032 return source1.Provider.CreateQuery<TResult>(
18033 Expression.Call(
18034 null,
18035 #if CRIPPLED_REFLECTION
18036 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TResult>>))),
18037 #else
18038 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TResult)),
18039 #endif
18040 source1.Expression,
18041 GetSourceExpression(source2),
18042 GetSourceExpression(source3),
18043 GetSourceExpression(source4),
18044 GetSourceExpression(source5),
18045 GetSourceExpression(source6),
18046 GetSourceExpression(source7),
18047 GetSourceExpression(source8),
18048 GetSourceExpression(source9),
18049 GetSourceExpression(source10),
18050 GetSourceExpression(source11),
18051 GetSourceExpression(source12),
18052 GetSourceExpression(source13),
18053 GetSourceExpression(source14),
18054 resultSelector
18055 )
18056 );
18057 }
18058 #endif
18059
18060 #if !NO_LARGEARITY
18061 /// <summary>
18062 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
18063 /// </summary>
18064 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
18065 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
18066 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
18067 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
18068 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
18069 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
18070 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
18071 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
18072 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
18073 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
18074 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
18075 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
18076 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
18077 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
18078 /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
18079 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
18080 /// <param name="source1">First observable source.</param>
18081 /// <param name="source2">Second observable source.</param>
18082 /// <param name="source3">Third observable source.</param>
18083 /// <param name="source4">Fourth observable source.</param>
18084 /// <param name="source5">Fifth observable source.</param>
18085 /// <param name="source6">Sixth observable source.</param>
18086 /// <param name="source7">Seventh observable source.</param>
18087 /// <param name="source8">Eighth observable source.</param>
18088 /// <param name="source9">Ninth observable source.</param>
18089 /// <param name="source10">Tenth observable source.</param>
18090 /// <param name="source11">Eleventh observable source.</param>
18091 /// <param name="source12">Twelfth observable source.</param>
18092 /// <param name="source13">Thirteenth observable source.</param>
18093 /// <param name="source14">Fourteenth observable source.</param>
18094 /// <param name="source15">Fifteenth observable source.</param>
18095 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
18096 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
18097 /// <exception cref="T:System.ArgumentNullException">
18098 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="resultSelector" /> is null.</exception>
18099 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>> resultSelector)
18100 {
18101 if (source1 == null)
18102 throw new ArgumentNullException("source1");
18103 if (source2 == null)
18104 throw new ArgumentNullException("source2");
18105 if (source3 == null)
18106 throw new ArgumentNullException("source3");
18107 if (source4 == null)
18108 throw new ArgumentNullException("source4");
18109 if (source5 == null)
18110 throw new ArgumentNullException("source5");
18111 if (source6 == null)
18112 throw new ArgumentNullException("source6");
18113 if (source7 == null)
18114 throw new ArgumentNullException("source7");
18115 if (source8 == null)
18116 throw new ArgumentNullException("source8");
18117 if (source9 == null)
18118 throw new ArgumentNullException("source9");
18119 if (source10 == null)
18120 throw new ArgumentNullException("source10");
18121 if (source11 == null)
18122 throw new ArgumentNullException("source11");
18123 if (source12 == null)
18124 throw new ArgumentNullException("source12");
18125 if (source13 == null)
18126 throw new ArgumentNullException("source13");
18127 if (source14 == null)
18128 throw new ArgumentNullException("source14");
18129 if (source15 == null)
18130 throw new ArgumentNullException("source15");
18131 if (resultSelector == null)
18132 throw new ArgumentNullException("resultSelector");
18133
18134 return source1.Provider.CreateQuery<TResult>(
18135 Expression.Call(
18136 null,
18137 #if CRIPPLED_REFLECTION
18138 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TResult>>))),
18139 #else
18140 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TResult)),
18141 #endif
18142 source1.Expression,
18143 GetSourceExpression(source2),
18144 GetSourceExpression(source3),
18145 GetSourceExpression(source4),
18146 GetSourceExpression(source5),
18147 GetSourceExpression(source6),
18148 GetSourceExpression(source7),
18149 GetSourceExpression(source8),
18150 GetSourceExpression(source9),
18151 GetSourceExpression(source10),
18152 GetSourceExpression(source11),
18153 GetSourceExpression(source12),
18154 GetSourceExpression(source13),
18155 GetSourceExpression(source14),
18156 GetSourceExpression(source15),
18157 resultSelector
18158 )
18159 );
18160 }
18161 #endif
18162
18163 #if !NO_LARGEARITY
18164 /// <summary>
18165 /// Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
18166 /// </summary>
18167 /// <typeparam name="TSource1">The type of the elements in the first source sequence.</typeparam>
18168 /// <typeparam name="TSource2">The type of the elements in the second source sequence.</typeparam>
18169 /// <typeparam name="TSource3">The type of the elements in the third source sequence.</typeparam>
18170 /// <typeparam name="TSource4">The type of the elements in the fourth source sequence.</typeparam>
18171 /// <typeparam name="TSource5">The type of the elements in the fifth source sequence.</typeparam>
18172 /// <typeparam name="TSource6">The type of the elements in the sixth source sequence.</typeparam>
18173 /// <typeparam name="TSource7">The type of the elements in the seventh source sequence.</typeparam>
18174 /// <typeparam name="TSource8">The type of the elements in the eighth source sequence.</typeparam>
18175 /// <typeparam name="TSource9">The type of the elements in the ninth source sequence.</typeparam>
18176 /// <typeparam name="TSource10">The type of the elements in the tenth source sequence.</typeparam>
18177 /// <typeparam name="TSource11">The type of the elements in the eleventh source sequence.</typeparam>
18178 /// <typeparam name="TSource12">The type of the elements in the twelfth source sequence.</typeparam>
18179 /// <typeparam name="TSource13">The type of the elements in the thirteenth source sequence.</typeparam>
18180 /// <typeparam name="TSource14">The type of the elements in the fourteenth source sequence.</typeparam>
18181 /// <typeparam name="TSource15">The type of the elements in the fifteenth source sequence.</typeparam>
18182 /// <typeparam name="TSource16">The type of the elements in the sixteenth source sequence.</typeparam>
18183 /// <typeparam name="TResult">The type of the elements in the result sequence, returned by the selector function.</typeparam>
18184 /// <param name="source1">First observable source.</param>
18185 /// <param name="source2">Second observable source.</param>
18186 /// <param name="source3">Third observable source.</param>
18187 /// <param name="source4">Fourth observable source.</param>
18188 /// <param name="source5">Fifth observable source.</param>
18189 /// <param name="source6">Sixth observable source.</param>
18190 /// <param name="source7">Seventh observable source.</param>
18191 /// <param name="source8">Eighth observable source.</param>
18192 /// <param name="source9">Ninth observable source.</param>
18193 /// <param name="source10">Tenth observable source.</param>
18194 /// <param name="source11">Eleventh observable source.</param>
18195 /// <param name="source12">Twelfth observable source.</param>
18196 /// <param name="source13">Thirteenth observable source.</param>
18197 /// <param name="source14">Fourteenth observable source.</param>
18198 /// <param name="source15">Fifteenth observable source.</param>
18199 /// <param name="source16">Sixteenth observable source.</param>
18200 /// <param name="resultSelector">Function to invoke for each series of elements at corresponding indexes in the sources.</param>
18201 /// <returns>An observable sequence containing the result of combining elements of the sources using the specified result selector function.</returns>
18202 /// <exception cref="T:System.ArgumentNullException">
18203 /// <paramref name="source1" /> or <paramref name="source2" /> or <paramref name="source3" /> or <paramref name="source4" /> or <paramref name="source5" /> or <paramref name="source6" /> or <paramref name="source7" /> or <paramref name="source8" /> or <paramref name="source9" /> or <paramref name="source10" /> or <paramref name="source11" /> or <paramref name="source12" /> or <paramref name="source13" /> or <paramref name="source14" /> or <paramref name="source15" /> or <paramref name="source16" /> or <paramref name="resultSelector" /> is null.</exception>
18204 public static IQbservable<TResult> Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(this IQbservable<TSource1> source1, IObservable<TSource2> source2, IObservable<TSource3> source3, IObservable<TSource4> source4, IObservable<TSource5> source5, IObservable<TSource6> source6, IObservable<TSource7> source7, IObservable<TSource8> source8, IObservable<TSource9> source9, IObservable<TSource10> source10, IObservable<TSource11> source11, IObservable<TSource12> source12, IObservable<TSource13> source13, IObservable<TSource14> source14, IObservable<TSource15> source15, IObservable<TSource16> source16, Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>> resultSelector)
18205 {
18206 if (source1 == null)
18207 throw new ArgumentNullException("source1");
18208 if (source2 == null)
18209 throw new ArgumentNullException("source2");
18210 if (source3 == null)
18211 throw new ArgumentNullException("source3");
18212 if (source4 == null)
18213 throw new ArgumentNullException("source4");
18214 if (source5 == null)
18215 throw new ArgumentNullException("source5");
18216 if (source6 == null)
18217 throw new ArgumentNullException("source6");
18218 if (source7 == null)
18219 throw new ArgumentNullException("source7");
18220 if (source8 == null)
18221 throw new ArgumentNullException("source8");
18222 if (source9 == null)
18223 throw new ArgumentNullException("source9");
18224 if (source10 == null)
18225 throw new ArgumentNullException("source10");
18226 if (source11 == null)
18227 throw new ArgumentNullException("source11");
18228 if (source12 == null)
18229 throw new ArgumentNullException("source12");
18230 if (source13 == null)
18231 throw new ArgumentNullException("source13");
18232 if (source14 == null)
18233 throw new ArgumentNullException("source14");
18234 if (source15 == null)
18235 throw new ArgumentNullException("source15");
18236 if (source16 == null)
18237 throw new ArgumentNullException("source16");
18238 if (resultSelector == null)
18239 throw new ArgumentNullException("resultSelector");
18240
18241 return source1.Provider.CreateQuery<TResult>(
18242 Expression.Call(
18243 null,
18244 #if CRIPPLED_REFLECTION
18245 InfoOf(() => Qbservable.Zip<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>(default(IQbservable<TSource1>), default(IObservable<TSource2>), default(IObservable<TSource3>), default(IObservable<TSource4>), default(IObservable<TSource5>), default(IObservable<TSource6>), default(IObservable<TSource7>), default(IObservable<TSource8>), default(IObservable<TSource9>), default(IObservable<TSource10>), default(IObservable<TSource11>), default(IObservable<TSource12>), default(IObservable<TSource13>), default(IObservable<TSource14>), default(IObservable<TSource15>), default(IObservable<TSource16>), default(Expression<Func<TSource1, TSource2, TSource3, TSource4, TSource5, TSource6, TSource7, TSource8, TSource9, TSource10, TSource11, TSource12, TSource13, TSource14, TSource15, TSource16, TResult>>))),
18246 #else
18247 ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource1), typeof(TSource2), typeof(TSource3), typeof(TSource4), typeof(TSource5), typeof(TSource6), typeof(TSource7), typeof(TSource8), typeof(TSource9), typeof(TSource10), typeof(TSource11), typeof(TSource12), typeof(TSource13), typeof(TSource14), typeof(TSource15), typeof(TSource16), typeof(TResult)),
18248 #endif
18249 source1.Expression,
18250 GetSourceExpression(source2),
18251 GetSourceExpression(source3),
18252 GetSourceExpression(source4),
18253 GetSourceExpression(source5),
18254 GetSourceExpression(source6),
18255 GetSourceExpression(source7),
18256 GetSourceExpression(source8),
18257 GetSourceExpression(source9),
18258 GetSourceExpression(source10),
18259 GetSourceExpression(source11),
18260 GetSourceExpression(source12),
18261 GetSourceExpression(source13),
18262 GetSourceExpression(source14),
18263 GetSourceExpression(source15),
18264 GetSourceExpression(source16),
18265 resultSelector
18266 )
18267 );
18268 }
18269 #endif
18270
18271 /// <summary>
18272 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18273 /// </summary>
18274 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18275 /// <param name="action">Action to convert to an asynchronous action.</param>
18276 /// <returns>Asynchronous action.</returns>
18277 /// <exception cref="T:System.ArgumentNullException">
18278 /// <paramref name="action" /> is null.</exception>
18279 public static Func<IQbservable<Unit>> ToAsync(this IQbservableProvider provider, Expression<Action> action)
18280 {
18281 if (provider == null)
18282 throw new ArgumentNullException("provider");
18283 if (action == null)
18284 throw new ArgumentNullException("action");
18285
18286 #if CRIPPLED_REFLECTION
18287 var m = InfoOf(() => Qbservable.ToAsync(default(IQbservableProvider), default(Expression<Action>)));
18288 #else
18289 var m = (MethodInfo)MethodInfo.GetCurrentMethod();
18290 #endif
18291 return () => provider.CreateQuery<Unit>(
18292 Expression.Invoke(
18293 Expression.Call(
18294 null,
18295 m,
18296 Expression.Constant(provider, typeof(IQbservableProvider)),
18297 action
18298 )
18299 )
18300 );
18301 }
18302
18303 /// <summary>
18304 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18305 /// </summary>
18306 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18307 /// <param name="action">Action to convert to an asynchronous action.</param>
18308 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18309 /// <returns>Asynchronous action.</returns>
18310 /// <exception cref="T:System.ArgumentNullException">
18311 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18312 public static Func<IQbservable<Unit>> ToAsync(this IQbservableProvider provider, Expression<Action> action, IScheduler scheduler)
18313 {
18314 if (provider == null)
18315 throw new ArgumentNullException("provider");
18316 if (action == null)
18317 throw new ArgumentNullException("action");
18318 if (scheduler == null)
18319 throw new ArgumentNullException("scheduler");
18320
18321 #if CRIPPLED_REFLECTION
18322 var m = InfoOf(() => Qbservable.ToAsync(default(IQbservableProvider), default(Expression<Action>), default(IScheduler)));
18323 #else
18324 var m = (MethodInfo)MethodInfo.GetCurrentMethod();
18325 #endif
18326 return () => provider.CreateQuery<Unit>(
18327 Expression.Invoke(
18328 Expression.Call(
18329 null,
18330 m,
18331 Expression.Constant(provider, typeof(IQbservableProvider)),
18332 action,
18333 Expression.Constant(scheduler, typeof(IScheduler))
18334 )
18335 )
18336 );
18337 }
18338
18339 /// <summary>
18340 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18341 /// </summary>
18342 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18343 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18344 /// <param name="action">Action to convert to an asynchronous action.</param>
18345 /// <returns>Asynchronous action.</returns>
18346 /// <exception cref="T:System.ArgumentNullException">
18347 /// <paramref name="action" /> is null.</exception>
18348 public static Func<TArg1, IQbservable<Unit>> ToAsync<TArg1>(this IQbservableProvider provider, Expression<Action<TArg1>> action)
18349 {
18350 if (provider == null)
18351 throw new ArgumentNullException("provider");
18352 if (action == null)
18353 throw new ArgumentNullException("action");
18354
18355 #if CRIPPLED_REFLECTION
18356 var m = InfoOf(() => Qbservable.ToAsync<TArg1>(default(IQbservableProvider), default(Expression<Action<TArg1>>)));
18357 #else
18358 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
18359 #endif
18360 return (t1) => provider.CreateQuery<Unit>(
18361 Expression.Invoke(
18362 Expression.Call(
18363 null,
18364 m,
18365 Expression.Constant(provider, typeof(IQbservableProvider)),
18366 action
18367 ),
18368 Expression.Constant(t1, typeof(TArg1))
18369 )
18370 );
18371 }
18372
18373 /// <summary>
18374 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18375 /// </summary>
18376 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18377 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18378 /// <param name="action">Action to convert to an asynchronous action.</param>
18379 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18380 /// <returns>Asynchronous action.</returns>
18381 /// <exception cref="T:System.ArgumentNullException">
18382 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18383 public static Func<TArg1, IQbservable<Unit>> ToAsync<TArg1>(this IQbservableProvider provider, Expression<Action<TArg1>> action, IScheduler scheduler)
18384 {
18385 if (provider == null)
18386 throw new ArgumentNullException("provider");
18387 if (action == null)
18388 throw new ArgumentNullException("action");
18389 if (scheduler == null)
18390 throw new ArgumentNullException("scheduler");
18391
18392 #if CRIPPLED_REFLECTION
18393 var m = InfoOf(() => Qbservable.ToAsync<TArg1>(default(IQbservableProvider), default(Expression<Action<TArg1>>), default(IScheduler)));
18394 #else
18395 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
18396 #endif
18397 return (t1) => provider.CreateQuery<Unit>(
18398 Expression.Invoke(
18399 Expression.Call(
18400 null,
18401 m,
18402 Expression.Constant(provider, typeof(IQbservableProvider)),
18403 action,
18404 Expression.Constant(scheduler, typeof(IScheduler))
18405 ),
18406 Expression.Constant(t1, typeof(TArg1))
18407 )
18408 );
18409 }
18410
18411 /// <summary>
18412 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18413 /// </summary>
18414 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18415 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18416 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18417 /// <param name="action">Action to convert to an asynchronous action.</param>
18418 /// <returns>Asynchronous action.</returns>
18419 /// <exception cref="T:System.ArgumentNullException">
18420 /// <paramref name="action" /> is null.</exception>
18421 public static Func<TArg1, TArg2, IQbservable<Unit>> ToAsync<TArg1, TArg2>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2>> action)
18422 {
18423 if (provider == null)
18424 throw new ArgumentNullException("provider");
18425 if (action == null)
18426 throw new ArgumentNullException("action");
18427
18428 #if CRIPPLED_REFLECTION
18429 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2>>)));
18430 #else
18431 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
18432 #endif
18433 return (t1, t2) => provider.CreateQuery<Unit>(
18434 Expression.Invoke(
18435 Expression.Call(
18436 null,
18437 m,
18438 Expression.Constant(provider, typeof(IQbservableProvider)),
18439 action
18440 ),
18441 Expression.Constant(t1, typeof(TArg1)),
18442 Expression.Constant(t2, typeof(TArg2))
18443 )
18444 );
18445 }
18446
18447 /// <summary>
18448 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18449 /// </summary>
18450 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18451 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18452 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18453 /// <param name="action">Action to convert to an asynchronous action.</param>
18454 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18455 /// <returns>Asynchronous action.</returns>
18456 /// <exception cref="T:System.ArgumentNullException">
18457 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18458 public static Func<TArg1, TArg2, IQbservable<Unit>> ToAsync<TArg1, TArg2>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2>> action, IScheduler scheduler)
18459 {
18460 if (provider == null)
18461 throw new ArgumentNullException("provider");
18462 if (action == null)
18463 throw new ArgumentNullException("action");
18464 if (scheduler == null)
18465 throw new ArgumentNullException("scheduler");
18466
18467 #if CRIPPLED_REFLECTION
18468 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2>>), default(IScheduler)));
18469 #else
18470 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
18471 #endif
18472 return (t1, t2) => provider.CreateQuery<Unit>(
18473 Expression.Invoke(
18474 Expression.Call(
18475 null,
18476 m,
18477 Expression.Constant(provider, typeof(IQbservableProvider)),
18478 action,
18479 Expression.Constant(scheduler, typeof(IScheduler))
18480 ),
18481 Expression.Constant(t1, typeof(TArg1)),
18482 Expression.Constant(t2, typeof(TArg2))
18483 )
18484 );
18485 }
18486
18487 /// <summary>
18488 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18489 /// </summary>
18490 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18491 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18492 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18493 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18494 /// <param name="action">Action to convert to an asynchronous action.</param>
18495 /// <returns>Asynchronous action.</returns>
18496 /// <exception cref="T:System.ArgumentNullException">
18497 /// <paramref name="action" /> is null.</exception>
18498 public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3>> action)
18499 {
18500 if (provider == null)
18501 throw new ArgumentNullException("provider");
18502 if (action == null)
18503 throw new ArgumentNullException("action");
18504
18505 #if CRIPPLED_REFLECTION
18506 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3>>)));
18507 #else
18508 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
18509 #endif
18510 return (t1, t2, t3) => provider.CreateQuery<Unit>(
18511 Expression.Invoke(
18512 Expression.Call(
18513 null,
18514 m,
18515 Expression.Constant(provider, typeof(IQbservableProvider)),
18516 action
18517 ),
18518 Expression.Constant(t1, typeof(TArg1)),
18519 Expression.Constant(t2, typeof(TArg2)),
18520 Expression.Constant(t3, typeof(TArg3))
18521 )
18522 );
18523 }
18524
18525 /// <summary>
18526 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18527 /// </summary>
18528 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18529 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18530 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18531 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18532 /// <param name="action">Action to convert to an asynchronous action.</param>
18533 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18534 /// <returns>Asynchronous action.</returns>
18535 /// <exception cref="T:System.ArgumentNullException">
18536 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18537 public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3>> action, IScheduler scheduler)
18538 {
18539 if (provider == null)
18540 throw new ArgumentNullException("provider");
18541 if (action == null)
18542 throw new ArgumentNullException("action");
18543 if (scheduler == null)
18544 throw new ArgumentNullException("scheduler");
18545
18546 #if CRIPPLED_REFLECTION
18547 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3>>), default(IScheduler)));
18548 #else
18549 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
18550 #endif
18551 return (t1, t2, t3) => provider.CreateQuery<Unit>(
18552 Expression.Invoke(
18553 Expression.Call(
18554 null,
18555 m,
18556 Expression.Constant(provider, typeof(IQbservableProvider)),
18557 action,
18558 Expression.Constant(scheduler, typeof(IScheduler))
18559 ),
18560 Expression.Constant(t1, typeof(TArg1)),
18561 Expression.Constant(t2, typeof(TArg2)),
18562 Expression.Constant(t3, typeof(TArg3))
18563 )
18564 );
18565 }
18566
18567 /// <summary>
18568 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18569 /// </summary>
18570 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18571 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18572 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18573 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18574 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18575 /// <param name="action">Action to convert to an asynchronous action.</param>
18576 /// <returns>Asynchronous action.</returns>
18577 /// <exception cref="T:System.ArgumentNullException">
18578 /// <paramref name="action" /> is null.</exception>
18579 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4>> action)
18580 {
18581 if (provider == null)
18582 throw new ArgumentNullException("provider");
18583 if (action == null)
18584 throw new ArgumentNullException("action");
18585
18586 #if CRIPPLED_REFLECTION
18587 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4>>)));
18588 #else
18589 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
18590 #endif
18591 return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
18592 Expression.Invoke(
18593 Expression.Call(
18594 null,
18595 m,
18596 Expression.Constant(provider, typeof(IQbservableProvider)),
18597 action
18598 ),
18599 Expression.Constant(t1, typeof(TArg1)),
18600 Expression.Constant(t2, typeof(TArg2)),
18601 Expression.Constant(t3, typeof(TArg3)),
18602 Expression.Constant(t4, typeof(TArg4))
18603 )
18604 );
18605 }
18606
18607 /// <summary>
18608 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18609 /// </summary>
18610 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18611 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18612 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18613 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18614 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18615 /// <param name="action">Action to convert to an asynchronous action.</param>
18616 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18617 /// <returns>Asynchronous action.</returns>
18618 /// <exception cref="T:System.ArgumentNullException">
18619 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18620 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4>> action, IScheduler scheduler)
18621 {
18622 if (provider == null)
18623 throw new ArgumentNullException("provider");
18624 if (action == null)
18625 throw new ArgumentNullException("action");
18626 if (scheduler == null)
18627 throw new ArgumentNullException("scheduler");
18628
18629 #if CRIPPLED_REFLECTION
18630 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4>>), default(IScheduler)));
18631 #else
18632 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
18633 #endif
18634 return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
18635 Expression.Invoke(
18636 Expression.Call(
18637 null,
18638 m,
18639 Expression.Constant(provider, typeof(IQbservableProvider)),
18640 action,
18641 Expression.Constant(scheduler, typeof(IScheduler))
18642 ),
18643 Expression.Constant(t1, typeof(TArg1)),
18644 Expression.Constant(t2, typeof(TArg2)),
18645 Expression.Constant(t3, typeof(TArg3)),
18646 Expression.Constant(t4, typeof(TArg4))
18647 )
18648 );
18649 }
18650
18651 #if !NO_LARGEARITY
18652 /// <summary>
18653 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18654 /// </summary>
18655 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18656 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18657 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18658 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18659 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18660 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18661 /// <param name="action">Action to convert to an asynchronous action.</param>
18662 /// <returns>Asynchronous action.</returns>
18663 /// <exception cref="T:System.ArgumentNullException">
18664 /// <paramref name="action" /> is null.</exception>
18665 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>> action)
18666 {
18667 if (provider == null)
18668 throw new ArgumentNullException("provider");
18669 if (action == null)
18670 throw new ArgumentNullException("action");
18671
18672 #if CRIPPLED_REFLECTION
18673 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>>)));
18674 #else
18675 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
18676 #endif
18677 return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
18678 Expression.Invoke(
18679 Expression.Call(
18680 null,
18681 m,
18682 Expression.Constant(provider, typeof(IQbservableProvider)),
18683 action
18684 ),
18685 Expression.Constant(t1, typeof(TArg1)),
18686 Expression.Constant(t2, typeof(TArg2)),
18687 Expression.Constant(t3, typeof(TArg3)),
18688 Expression.Constant(t4, typeof(TArg4)),
18689 Expression.Constant(t5, typeof(TArg5))
18690 )
18691 );
18692 }
18693
18694 /// <summary>
18695 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18696 /// </summary>
18697 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18698 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18699 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18700 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18701 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18702 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18703 /// <param name="action">Action to convert to an asynchronous action.</param>
18704 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18705 /// <returns>Asynchronous action.</returns>
18706 /// <exception cref="T:System.ArgumentNullException">
18707 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18708 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>> action, IScheduler scheduler)
18709 {
18710 if (provider == null)
18711 throw new ArgumentNullException("provider");
18712 if (action == null)
18713 throw new ArgumentNullException("action");
18714 if (scheduler == null)
18715 throw new ArgumentNullException("scheduler");
18716
18717 #if CRIPPLED_REFLECTION
18718 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5>>), default(IScheduler)));
18719 #else
18720 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
18721 #endif
18722 return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
18723 Expression.Invoke(
18724 Expression.Call(
18725 null,
18726 m,
18727 Expression.Constant(provider, typeof(IQbservableProvider)),
18728 action,
18729 Expression.Constant(scheduler, typeof(IScheduler))
18730 ),
18731 Expression.Constant(t1, typeof(TArg1)),
18732 Expression.Constant(t2, typeof(TArg2)),
18733 Expression.Constant(t3, typeof(TArg3)),
18734 Expression.Constant(t4, typeof(TArg4)),
18735 Expression.Constant(t5, typeof(TArg5))
18736 )
18737 );
18738 }
18739
18740 /// <summary>
18741 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18742 /// </summary>
18743 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18744 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18745 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18746 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18747 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18748 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18749 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18750 /// <param name="action">Action to convert to an asynchronous action.</param>
18751 /// <returns>Asynchronous action.</returns>
18752 /// <exception cref="T:System.ArgumentNullException">
18753 /// <paramref name="action" /> is null.</exception>
18754 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>> action)
18755 {
18756 if (provider == null)
18757 throw new ArgumentNullException("provider");
18758 if (action == null)
18759 throw new ArgumentNullException("action");
18760
18761 #if CRIPPLED_REFLECTION
18762 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>>)));
18763 #else
18764 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
18765 #endif
18766 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
18767 Expression.Invoke(
18768 Expression.Call(
18769 null,
18770 m,
18771 Expression.Constant(provider, typeof(IQbservableProvider)),
18772 action
18773 ),
18774 Expression.Constant(t1, typeof(TArg1)),
18775 Expression.Constant(t2, typeof(TArg2)),
18776 Expression.Constant(t3, typeof(TArg3)),
18777 Expression.Constant(t4, typeof(TArg4)),
18778 Expression.Constant(t5, typeof(TArg5)),
18779 Expression.Constant(t6, typeof(TArg6))
18780 )
18781 );
18782 }
18783
18784 /// <summary>
18785 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18786 /// </summary>
18787 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18788 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18789 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18790 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18791 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18792 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18793 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18794 /// <param name="action">Action to convert to an asynchronous action.</param>
18795 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18796 /// <returns>Asynchronous action.</returns>
18797 /// <exception cref="T:System.ArgumentNullException">
18798 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18799 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>> action, IScheduler scheduler)
18800 {
18801 if (provider == null)
18802 throw new ArgumentNullException("provider");
18803 if (action == null)
18804 throw new ArgumentNullException("action");
18805 if (scheduler == null)
18806 throw new ArgumentNullException("scheduler");
18807
18808 #if CRIPPLED_REFLECTION
18809 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>>), default(IScheduler)));
18810 #else
18811 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
18812 #endif
18813 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
18814 Expression.Invoke(
18815 Expression.Call(
18816 null,
18817 m,
18818 Expression.Constant(provider, typeof(IQbservableProvider)),
18819 action,
18820 Expression.Constant(scheduler, typeof(IScheduler))
18821 ),
18822 Expression.Constant(t1, typeof(TArg1)),
18823 Expression.Constant(t2, typeof(TArg2)),
18824 Expression.Constant(t3, typeof(TArg3)),
18825 Expression.Constant(t4, typeof(TArg4)),
18826 Expression.Constant(t5, typeof(TArg5)),
18827 Expression.Constant(t6, typeof(TArg6))
18828 )
18829 );
18830 }
18831
18832 /// <summary>
18833 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18834 /// </summary>
18835 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18836 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18837 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18838 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18839 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18840 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18841 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18842 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
18843 /// <param name="action">Action to convert to an asynchronous action.</param>
18844 /// <returns>Asynchronous action.</returns>
18845 /// <exception cref="T:System.ArgumentNullException">
18846 /// <paramref name="action" /> is null.</exception>
18847 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>> action)
18848 {
18849 if (provider == null)
18850 throw new ArgumentNullException("provider");
18851 if (action == null)
18852 throw new ArgumentNullException("action");
18853
18854 #if CRIPPLED_REFLECTION
18855 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>>)));
18856 #else
18857 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
18858 #endif
18859 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
18860 Expression.Invoke(
18861 Expression.Call(
18862 null,
18863 m,
18864 Expression.Constant(provider, typeof(IQbservableProvider)),
18865 action
18866 ),
18867 Expression.Constant(t1, typeof(TArg1)),
18868 Expression.Constant(t2, typeof(TArg2)),
18869 Expression.Constant(t3, typeof(TArg3)),
18870 Expression.Constant(t4, typeof(TArg4)),
18871 Expression.Constant(t5, typeof(TArg5)),
18872 Expression.Constant(t6, typeof(TArg6)),
18873 Expression.Constant(t7, typeof(TArg7))
18874 )
18875 );
18876 }
18877
18878 /// <summary>
18879 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18880 /// </summary>
18881 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18882 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18883 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18884 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18885 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18886 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18887 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18888 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
18889 /// <param name="action">Action to convert to an asynchronous action.</param>
18890 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18891 /// <returns>Asynchronous action.</returns>
18892 /// <exception cref="T:System.ArgumentNullException">
18893 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18894 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>> action, IScheduler scheduler)
18895 {
18896 if (provider == null)
18897 throw new ArgumentNullException("provider");
18898 if (action == null)
18899 throw new ArgumentNullException("action");
18900 if (scheduler == null)
18901 throw new ArgumentNullException("scheduler");
18902
18903 #if CRIPPLED_REFLECTION
18904 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>>), default(IScheduler)));
18905 #else
18906 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
18907 #endif
18908 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
18909 Expression.Invoke(
18910 Expression.Call(
18911 null,
18912 m,
18913 Expression.Constant(provider, typeof(IQbservableProvider)),
18914 action,
18915 Expression.Constant(scheduler, typeof(IScheduler))
18916 ),
18917 Expression.Constant(t1, typeof(TArg1)),
18918 Expression.Constant(t2, typeof(TArg2)),
18919 Expression.Constant(t3, typeof(TArg3)),
18920 Expression.Constant(t4, typeof(TArg4)),
18921 Expression.Constant(t5, typeof(TArg5)),
18922 Expression.Constant(t6, typeof(TArg6)),
18923 Expression.Constant(t7, typeof(TArg7))
18924 )
18925 );
18926 }
18927
18928 /// <summary>
18929 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
18930 /// </summary>
18931 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18932 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18933 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18934 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18935 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18936 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18937 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18938 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
18939 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
18940 /// <param name="action">Action to convert to an asynchronous action.</param>
18941 /// <returns>Asynchronous action.</returns>
18942 /// <exception cref="T:System.ArgumentNullException">
18943 /// <paramref name="action" /> is null.</exception>
18944 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>> action)
18945 {
18946 if (provider == null)
18947 throw new ArgumentNullException("provider");
18948 if (action == null)
18949 throw new ArgumentNullException("action");
18950
18951 #if CRIPPLED_REFLECTION
18952 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>>)));
18953 #else
18954 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
18955 #endif
18956 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
18957 Expression.Invoke(
18958 Expression.Call(
18959 null,
18960 m,
18961 Expression.Constant(provider, typeof(IQbservableProvider)),
18962 action
18963 ),
18964 Expression.Constant(t1, typeof(TArg1)),
18965 Expression.Constant(t2, typeof(TArg2)),
18966 Expression.Constant(t3, typeof(TArg3)),
18967 Expression.Constant(t4, typeof(TArg4)),
18968 Expression.Constant(t5, typeof(TArg5)),
18969 Expression.Constant(t6, typeof(TArg6)),
18970 Expression.Constant(t7, typeof(TArg7)),
18971 Expression.Constant(t8, typeof(TArg8))
18972 )
18973 );
18974 }
18975
18976 /// <summary>
18977 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
18978 /// </summary>
18979 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
18980 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
18981 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
18982 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
18983 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
18984 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
18985 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
18986 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
18987 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
18988 /// <param name="action">Action to convert to an asynchronous action.</param>
18989 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
18990 /// <returns>Asynchronous action.</returns>
18991 /// <exception cref="T:System.ArgumentNullException">
18992 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
18993 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>> action, IScheduler scheduler)
18994 {
18995 if (provider == null)
18996 throw new ArgumentNullException("provider");
18997 if (action == null)
18998 throw new ArgumentNullException("action");
18999 if (scheduler == null)
19000 throw new ArgumentNullException("scheduler");
19001
19002 #if CRIPPLED_REFLECTION
19003 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>>), default(IScheduler)));
19004 #else
19005 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
19006 #endif
19007 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
19008 Expression.Invoke(
19009 Expression.Call(
19010 null,
19011 m,
19012 Expression.Constant(provider, typeof(IQbservableProvider)),
19013 action,
19014 Expression.Constant(scheduler, typeof(IScheduler))
19015 ),
19016 Expression.Constant(t1, typeof(TArg1)),
19017 Expression.Constant(t2, typeof(TArg2)),
19018 Expression.Constant(t3, typeof(TArg3)),
19019 Expression.Constant(t4, typeof(TArg4)),
19020 Expression.Constant(t5, typeof(TArg5)),
19021 Expression.Constant(t6, typeof(TArg6)),
19022 Expression.Constant(t7, typeof(TArg7)),
19023 Expression.Constant(t8, typeof(TArg8))
19024 )
19025 );
19026 }
19027
19028 /// <summary>
19029 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19030 /// </summary>
19031 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19032 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19033 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19034 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19035 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19036 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19037 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19038 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19039 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19040 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19041 /// <param name="action">Action to convert to an asynchronous action.</param>
19042 /// <returns>Asynchronous action.</returns>
19043 /// <exception cref="T:System.ArgumentNullException">
19044 /// <paramref name="action" /> is null.</exception>
19045 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>> action)
19046 {
19047 if (provider == null)
19048 throw new ArgumentNullException("provider");
19049 if (action == null)
19050 throw new ArgumentNullException("action");
19051
19052 #if CRIPPLED_REFLECTION
19053 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>>)));
19054 #else
19055 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
19056 #endif
19057 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
19058 Expression.Invoke(
19059 Expression.Call(
19060 null,
19061 m,
19062 Expression.Constant(provider, typeof(IQbservableProvider)),
19063 action
19064 ),
19065 Expression.Constant(t1, typeof(TArg1)),
19066 Expression.Constant(t2, typeof(TArg2)),
19067 Expression.Constant(t3, typeof(TArg3)),
19068 Expression.Constant(t4, typeof(TArg4)),
19069 Expression.Constant(t5, typeof(TArg5)),
19070 Expression.Constant(t6, typeof(TArg6)),
19071 Expression.Constant(t7, typeof(TArg7)),
19072 Expression.Constant(t8, typeof(TArg8)),
19073 Expression.Constant(t9, typeof(TArg9))
19074 )
19075 );
19076 }
19077
19078 /// <summary>
19079 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19080 /// </summary>
19081 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19082 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19083 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19084 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19085 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19086 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19087 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19088 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19089 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19090 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19091 /// <param name="action">Action to convert to an asynchronous action.</param>
19092 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19093 /// <returns>Asynchronous action.</returns>
19094 /// <exception cref="T:System.ArgumentNullException">
19095 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19096 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>> action, IScheduler scheduler)
19097 {
19098 if (provider == null)
19099 throw new ArgumentNullException("provider");
19100 if (action == null)
19101 throw new ArgumentNullException("action");
19102 if (scheduler == null)
19103 throw new ArgumentNullException("scheduler");
19104
19105 #if CRIPPLED_REFLECTION
19106 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>>), default(IScheduler)));
19107 #else
19108 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
19109 #endif
19110 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
19111 Expression.Invoke(
19112 Expression.Call(
19113 null,
19114 m,
19115 Expression.Constant(provider, typeof(IQbservableProvider)),
19116 action,
19117 Expression.Constant(scheduler, typeof(IScheduler))
19118 ),
19119 Expression.Constant(t1, typeof(TArg1)),
19120 Expression.Constant(t2, typeof(TArg2)),
19121 Expression.Constant(t3, typeof(TArg3)),
19122 Expression.Constant(t4, typeof(TArg4)),
19123 Expression.Constant(t5, typeof(TArg5)),
19124 Expression.Constant(t6, typeof(TArg6)),
19125 Expression.Constant(t7, typeof(TArg7)),
19126 Expression.Constant(t8, typeof(TArg8)),
19127 Expression.Constant(t9, typeof(TArg9))
19128 )
19129 );
19130 }
19131
19132 /// <summary>
19133 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19134 /// </summary>
19135 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19136 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19137 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19138 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19139 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19140 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19141 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19142 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19143 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19144 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19145 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19146 /// <param name="action">Action to convert to an asynchronous action.</param>
19147 /// <returns>Asynchronous action.</returns>
19148 /// <exception cref="T:System.ArgumentNullException">
19149 /// <paramref name="action" /> is null.</exception>
19150 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>> action)
19151 {
19152 if (provider == null)
19153 throw new ArgumentNullException("provider");
19154 if (action == null)
19155 throw new ArgumentNullException("action");
19156
19157 #if CRIPPLED_REFLECTION
19158 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>>)));
19159 #else
19160 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
19161 #endif
19162 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
19163 Expression.Invoke(
19164 Expression.Call(
19165 null,
19166 m,
19167 Expression.Constant(provider, typeof(IQbservableProvider)),
19168 action
19169 ),
19170 Expression.Constant(t1, typeof(TArg1)),
19171 Expression.Constant(t2, typeof(TArg2)),
19172 Expression.Constant(t3, typeof(TArg3)),
19173 Expression.Constant(t4, typeof(TArg4)),
19174 Expression.Constant(t5, typeof(TArg5)),
19175 Expression.Constant(t6, typeof(TArg6)),
19176 Expression.Constant(t7, typeof(TArg7)),
19177 Expression.Constant(t8, typeof(TArg8)),
19178 Expression.Constant(t9, typeof(TArg9)),
19179 Expression.Constant(t10, typeof(TArg10))
19180 )
19181 );
19182 }
19183
19184 /// <summary>
19185 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19186 /// </summary>
19187 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19188 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19189 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19190 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19191 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19192 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19193 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19194 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19195 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19196 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19197 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19198 /// <param name="action">Action to convert to an asynchronous action.</param>
19199 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19200 /// <returns>Asynchronous action.</returns>
19201 /// <exception cref="T:System.ArgumentNullException">
19202 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19203 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>> action, IScheduler scheduler)
19204 {
19205 if (provider == null)
19206 throw new ArgumentNullException("provider");
19207 if (action == null)
19208 throw new ArgumentNullException("action");
19209 if (scheduler == null)
19210 throw new ArgumentNullException("scheduler");
19211
19212 #if CRIPPLED_REFLECTION
19213 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>>), default(IScheduler)));
19214 #else
19215 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
19216 #endif
19217 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
19218 Expression.Invoke(
19219 Expression.Call(
19220 null,
19221 m,
19222 Expression.Constant(provider, typeof(IQbservableProvider)),
19223 action,
19224 Expression.Constant(scheduler, typeof(IScheduler))
19225 ),
19226 Expression.Constant(t1, typeof(TArg1)),
19227 Expression.Constant(t2, typeof(TArg2)),
19228 Expression.Constant(t3, typeof(TArg3)),
19229 Expression.Constant(t4, typeof(TArg4)),
19230 Expression.Constant(t5, typeof(TArg5)),
19231 Expression.Constant(t6, typeof(TArg6)),
19232 Expression.Constant(t7, typeof(TArg7)),
19233 Expression.Constant(t8, typeof(TArg8)),
19234 Expression.Constant(t9, typeof(TArg9)),
19235 Expression.Constant(t10, typeof(TArg10))
19236 )
19237 );
19238 }
19239
19240 /// <summary>
19241 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19242 /// </summary>
19243 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19244 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19245 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19246 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19247 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19248 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19249 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19250 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19251 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19252 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19253 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19254 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19255 /// <param name="action">Action to convert to an asynchronous action.</param>
19256 /// <returns>Asynchronous action.</returns>
19257 /// <exception cref="T:System.ArgumentNullException">
19258 /// <paramref name="action" /> is null.</exception>
19259 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>> action)
19260 {
19261 if (provider == null)
19262 throw new ArgumentNullException("provider");
19263 if (action == null)
19264 throw new ArgumentNullException("action");
19265
19266 #if CRIPPLED_REFLECTION
19267 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>>)));
19268 #else
19269 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
19270 #endif
19271 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
19272 Expression.Invoke(
19273 Expression.Call(
19274 null,
19275 m,
19276 Expression.Constant(provider, typeof(IQbservableProvider)),
19277 action
19278 ),
19279 Expression.Constant(t1, typeof(TArg1)),
19280 Expression.Constant(t2, typeof(TArg2)),
19281 Expression.Constant(t3, typeof(TArg3)),
19282 Expression.Constant(t4, typeof(TArg4)),
19283 Expression.Constant(t5, typeof(TArg5)),
19284 Expression.Constant(t6, typeof(TArg6)),
19285 Expression.Constant(t7, typeof(TArg7)),
19286 Expression.Constant(t8, typeof(TArg8)),
19287 Expression.Constant(t9, typeof(TArg9)),
19288 Expression.Constant(t10, typeof(TArg10)),
19289 Expression.Constant(t11, typeof(TArg11))
19290 )
19291 );
19292 }
19293
19294 /// <summary>
19295 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19296 /// </summary>
19297 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19298 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19299 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19300 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19301 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19302 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19303 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19304 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19305 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19306 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19307 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19308 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19309 /// <param name="action">Action to convert to an asynchronous action.</param>
19310 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19311 /// <returns>Asynchronous action.</returns>
19312 /// <exception cref="T:System.ArgumentNullException">
19313 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19314 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>> action, IScheduler scheduler)
19315 {
19316 if (provider == null)
19317 throw new ArgumentNullException("provider");
19318 if (action == null)
19319 throw new ArgumentNullException("action");
19320 if (scheduler == null)
19321 throw new ArgumentNullException("scheduler");
19322
19323 #if CRIPPLED_REFLECTION
19324 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>>), default(IScheduler)));
19325 #else
19326 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
19327 #endif
19328 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
19329 Expression.Invoke(
19330 Expression.Call(
19331 null,
19332 m,
19333 Expression.Constant(provider, typeof(IQbservableProvider)),
19334 action,
19335 Expression.Constant(scheduler, typeof(IScheduler))
19336 ),
19337 Expression.Constant(t1, typeof(TArg1)),
19338 Expression.Constant(t2, typeof(TArg2)),
19339 Expression.Constant(t3, typeof(TArg3)),
19340 Expression.Constant(t4, typeof(TArg4)),
19341 Expression.Constant(t5, typeof(TArg5)),
19342 Expression.Constant(t6, typeof(TArg6)),
19343 Expression.Constant(t7, typeof(TArg7)),
19344 Expression.Constant(t8, typeof(TArg8)),
19345 Expression.Constant(t9, typeof(TArg9)),
19346 Expression.Constant(t10, typeof(TArg10)),
19347 Expression.Constant(t11, typeof(TArg11))
19348 )
19349 );
19350 }
19351
19352 /// <summary>
19353 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19354 /// </summary>
19355 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19356 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19357 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19358 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19359 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19360 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19361 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19362 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19363 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19364 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19365 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19366 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19367 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19368 /// <param name="action">Action to convert to an asynchronous action.</param>
19369 /// <returns>Asynchronous action.</returns>
19370 /// <exception cref="T:System.ArgumentNullException">
19371 /// <paramref name="action" /> is null.</exception>
19372 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>> action)
19373 {
19374 if (provider == null)
19375 throw new ArgumentNullException("provider");
19376 if (action == null)
19377 throw new ArgumentNullException("action");
19378
19379 #if CRIPPLED_REFLECTION
19380 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>>)));
19381 #else
19382 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
19383 #endif
19384 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
19385 Expression.Invoke(
19386 Expression.Call(
19387 null,
19388 m,
19389 Expression.Constant(provider, typeof(IQbservableProvider)),
19390 action
19391 ),
19392 Expression.Constant(t1, typeof(TArg1)),
19393 Expression.Constant(t2, typeof(TArg2)),
19394 Expression.Constant(t3, typeof(TArg3)),
19395 Expression.Constant(t4, typeof(TArg4)),
19396 Expression.Constant(t5, typeof(TArg5)),
19397 Expression.Constant(t6, typeof(TArg6)),
19398 Expression.Constant(t7, typeof(TArg7)),
19399 Expression.Constant(t8, typeof(TArg8)),
19400 Expression.Constant(t9, typeof(TArg9)),
19401 Expression.Constant(t10, typeof(TArg10)),
19402 Expression.Constant(t11, typeof(TArg11)),
19403 Expression.Constant(t12, typeof(TArg12))
19404 )
19405 );
19406 }
19407
19408 /// <summary>
19409 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19410 /// </summary>
19411 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19412 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19413 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19414 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19415 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19416 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19417 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19418 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19419 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19420 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19421 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19422 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19423 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19424 /// <param name="action">Action to convert to an asynchronous action.</param>
19425 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19426 /// <returns>Asynchronous action.</returns>
19427 /// <exception cref="T:System.ArgumentNullException">
19428 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19429 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>> action, IScheduler scheduler)
19430 {
19431 if (provider == null)
19432 throw new ArgumentNullException("provider");
19433 if (action == null)
19434 throw new ArgumentNullException("action");
19435 if (scheduler == null)
19436 throw new ArgumentNullException("scheduler");
19437
19438 #if CRIPPLED_REFLECTION
19439 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>>), default(IScheduler)));
19440 #else
19441 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
19442 #endif
19443 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
19444 Expression.Invoke(
19445 Expression.Call(
19446 null,
19447 m,
19448 Expression.Constant(provider, typeof(IQbservableProvider)),
19449 action,
19450 Expression.Constant(scheduler, typeof(IScheduler))
19451 ),
19452 Expression.Constant(t1, typeof(TArg1)),
19453 Expression.Constant(t2, typeof(TArg2)),
19454 Expression.Constant(t3, typeof(TArg3)),
19455 Expression.Constant(t4, typeof(TArg4)),
19456 Expression.Constant(t5, typeof(TArg5)),
19457 Expression.Constant(t6, typeof(TArg6)),
19458 Expression.Constant(t7, typeof(TArg7)),
19459 Expression.Constant(t8, typeof(TArg8)),
19460 Expression.Constant(t9, typeof(TArg9)),
19461 Expression.Constant(t10, typeof(TArg10)),
19462 Expression.Constant(t11, typeof(TArg11)),
19463 Expression.Constant(t12, typeof(TArg12))
19464 )
19465 );
19466 }
19467
19468 /// <summary>
19469 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19470 /// </summary>
19471 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19472 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19473 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19474 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19475 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19476 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19477 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19478 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19479 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19480 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19481 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19482 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19483 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19484 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19485 /// <param name="action">Action to convert to an asynchronous action.</param>
19486 /// <returns>Asynchronous action.</returns>
19487 /// <exception cref="T:System.ArgumentNullException">
19488 /// <paramref name="action" /> is null.</exception>
19489 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>> action)
19490 {
19491 if (provider == null)
19492 throw new ArgumentNullException("provider");
19493 if (action == null)
19494 throw new ArgumentNullException("action");
19495
19496 #if CRIPPLED_REFLECTION
19497 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>>)));
19498 #else
19499 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
19500 #endif
19501 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
19502 Expression.Invoke(
19503 Expression.Call(
19504 null,
19505 m,
19506 Expression.Constant(provider, typeof(IQbservableProvider)),
19507 action
19508 ),
19509 Expression.Constant(t1, typeof(TArg1)),
19510 Expression.Constant(t2, typeof(TArg2)),
19511 Expression.Constant(t3, typeof(TArg3)),
19512 Expression.Constant(t4, typeof(TArg4)),
19513 Expression.Constant(t5, typeof(TArg5)),
19514 Expression.Constant(t6, typeof(TArg6)),
19515 Expression.Constant(t7, typeof(TArg7)),
19516 Expression.Constant(t8, typeof(TArg8)),
19517 Expression.Constant(t9, typeof(TArg9)),
19518 Expression.Constant(t10, typeof(TArg10)),
19519 Expression.Constant(t11, typeof(TArg11)),
19520 Expression.Constant(t12, typeof(TArg12)),
19521 Expression.Constant(t13, typeof(TArg13))
19522 )
19523 );
19524 }
19525
19526 /// <summary>
19527 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19528 /// </summary>
19529 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19530 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19531 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19532 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19533 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19534 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19535 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19536 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19537 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19538 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19539 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19540 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19541 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19542 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19543 /// <param name="action">Action to convert to an asynchronous action.</param>
19544 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19545 /// <returns>Asynchronous action.</returns>
19546 /// <exception cref="T:System.ArgumentNullException">
19547 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19548 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>> action, IScheduler scheduler)
19549 {
19550 if (provider == null)
19551 throw new ArgumentNullException("provider");
19552 if (action == null)
19553 throw new ArgumentNullException("action");
19554 if (scheduler == null)
19555 throw new ArgumentNullException("scheduler");
19556
19557 #if CRIPPLED_REFLECTION
19558 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>>), default(IScheduler)));
19559 #else
19560 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
19561 #endif
19562 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
19563 Expression.Invoke(
19564 Expression.Call(
19565 null,
19566 m,
19567 Expression.Constant(provider, typeof(IQbservableProvider)),
19568 action,
19569 Expression.Constant(scheduler, typeof(IScheduler))
19570 ),
19571 Expression.Constant(t1, typeof(TArg1)),
19572 Expression.Constant(t2, typeof(TArg2)),
19573 Expression.Constant(t3, typeof(TArg3)),
19574 Expression.Constant(t4, typeof(TArg4)),
19575 Expression.Constant(t5, typeof(TArg5)),
19576 Expression.Constant(t6, typeof(TArg6)),
19577 Expression.Constant(t7, typeof(TArg7)),
19578 Expression.Constant(t8, typeof(TArg8)),
19579 Expression.Constant(t9, typeof(TArg9)),
19580 Expression.Constant(t10, typeof(TArg10)),
19581 Expression.Constant(t11, typeof(TArg11)),
19582 Expression.Constant(t12, typeof(TArg12)),
19583 Expression.Constant(t13, typeof(TArg13))
19584 )
19585 );
19586 }
19587
19588 /// <summary>
19589 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19590 /// </summary>
19591 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19592 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19593 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19594 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19595 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19596 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19597 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19598 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19599 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19600 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19601 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19602 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19603 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19604 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19605 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19606 /// <param name="action">Action to convert to an asynchronous action.</param>
19607 /// <returns>Asynchronous action.</returns>
19608 /// <exception cref="T:System.ArgumentNullException">
19609 /// <paramref name="action" /> is null.</exception>
19610 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>> action)
19611 {
19612 if (provider == null)
19613 throw new ArgumentNullException("provider");
19614 if (action == null)
19615 throw new ArgumentNullException("action");
19616
19617 #if CRIPPLED_REFLECTION
19618 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>>)));
19619 #else
19620 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
19621 #endif
19622 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
19623 Expression.Invoke(
19624 Expression.Call(
19625 null,
19626 m,
19627 Expression.Constant(provider, typeof(IQbservableProvider)),
19628 action
19629 ),
19630 Expression.Constant(t1, typeof(TArg1)),
19631 Expression.Constant(t2, typeof(TArg2)),
19632 Expression.Constant(t3, typeof(TArg3)),
19633 Expression.Constant(t4, typeof(TArg4)),
19634 Expression.Constant(t5, typeof(TArg5)),
19635 Expression.Constant(t6, typeof(TArg6)),
19636 Expression.Constant(t7, typeof(TArg7)),
19637 Expression.Constant(t8, typeof(TArg8)),
19638 Expression.Constant(t9, typeof(TArg9)),
19639 Expression.Constant(t10, typeof(TArg10)),
19640 Expression.Constant(t11, typeof(TArg11)),
19641 Expression.Constant(t12, typeof(TArg12)),
19642 Expression.Constant(t13, typeof(TArg13)),
19643 Expression.Constant(t14, typeof(TArg14))
19644 )
19645 );
19646 }
19647
19648 /// <summary>
19649 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19650 /// </summary>
19651 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19652 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19653 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19654 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19655 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19656 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19657 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19658 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19659 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19660 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19661 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19662 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19663 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19664 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19665 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19666 /// <param name="action">Action to convert to an asynchronous action.</param>
19667 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19668 /// <returns>Asynchronous action.</returns>
19669 /// <exception cref="T:System.ArgumentNullException">
19670 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19671 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>> action, IScheduler scheduler)
19672 {
19673 if (provider == null)
19674 throw new ArgumentNullException("provider");
19675 if (action == null)
19676 throw new ArgumentNullException("action");
19677 if (scheduler == null)
19678 throw new ArgumentNullException("scheduler");
19679
19680 #if CRIPPLED_REFLECTION
19681 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>>), default(IScheduler)));
19682 #else
19683 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
19684 #endif
19685 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
19686 Expression.Invoke(
19687 Expression.Call(
19688 null,
19689 m,
19690 Expression.Constant(provider, typeof(IQbservableProvider)),
19691 action,
19692 Expression.Constant(scheduler, typeof(IScheduler))
19693 ),
19694 Expression.Constant(t1, typeof(TArg1)),
19695 Expression.Constant(t2, typeof(TArg2)),
19696 Expression.Constant(t3, typeof(TArg3)),
19697 Expression.Constant(t4, typeof(TArg4)),
19698 Expression.Constant(t5, typeof(TArg5)),
19699 Expression.Constant(t6, typeof(TArg6)),
19700 Expression.Constant(t7, typeof(TArg7)),
19701 Expression.Constant(t8, typeof(TArg8)),
19702 Expression.Constant(t9, typeof(TArg9)),
19703 Expression.Constant(t10, typeof(TArg10)),
19704 Expression.Constant(t11, typeof(TArg11)),
19705 Expression.Constant(t12, typeof(TArg12)),
19706 Expression.Constant(t13, typeof(TArg13)),
19707 Expression.Constant(t14, typeof(TArg14))
19708 )
19709 );
19710 }
19711
19712 /// <summary>
19713 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19714 /// </summary>
19715 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19716 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19717 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19718 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19719 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19720 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19721 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19722 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19723 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19724 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19725 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19726 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19727 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19728 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19729 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19730 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
19731 /// <param name="action">Action to convert to an asynchronous action.</param>
19732 /// <returns>Asynchronous action.</returns>
19733 /// <exception cref="T:System.ArgumentNullException">
19734 /// <paramref name="action" /> is null.</exception>
19735 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>> action)
19736 {
19737 if (provider == null)
19738 throw new ArgumentNullException("provider");
19739 if (action == null)
19740 throw new ArgumentNullException("action");
19741
19742 #if CRIPPLED_REFLECTION
19743 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>>)));
19744 #else
19745 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15));
19746 #endif
19747 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<Unit>(
19748 Expression.Invoke(
19749 Expression.Call(
19750 null,
19751 m,
19752 Expression.Constant(provider, typeof(IQbservableProvider)),
19753 action
19754 ),
19755 Expression.Constant(t1, typeof(TArg1)),
19756 Expression.Constant(t2, typeof(TArg2)),
19757 Expression.Constant(t3, typeof(TArg3)),
19758 Expression.Constant(t4, typeof(TArg4)),
19759 Expression.Constant(t5, typeof(TArg5)),
19760 Expression.Constant(t6, typeof(TArg6)),
19761 Expression.Constant(t7, typeof(TArg7)),
19762 Expression.Constant(t8, typeof(TArg8)),
19763 Expression.Constant(t9, typeof(TArg9)),
19764 Expression.Constant(t10, typeof(TArg10)),
19765 Expression.Constant(t11, typeof(TArg11)),
19766 Expression.Constant(t12, typeof(TArg12)),
19767 Expression.Constant(t13, typeof(TArg13)),
19768 Expression.Constant(t14, typeof(TArg14)),
19769 Expression.Constant(t15, typeof(TArg15))
19770 )
19771 );
19772 }
19773
19774 /// <summary>
19775 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19776 /// </summary>
19777 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19778 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19779 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19780 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19781 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19782 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19783 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19784 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19785 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19786 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19787 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19788 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19789 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19790 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19791 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19792 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
19793 /// <param name="action">Action to convert to an asynchronous action.</param>
19794 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19795 /// <returns>Asynchronous action.</returns>
19796 /// <exception cref="T:System.ArgumentNullException">
19797 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19798 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>> action, IScheduler scheduler)
19799 {
19800 if (provider == null)
19801 throw new ArgumentNullException("provider");
19802 if (action == null)
19803 throw new ArgumentNullException("action");
19804 if (scheduler == null)
19805 throw new ArgumentNullException("scheduler");
19806
19807 #if CRIPPLED_REFLECTION
19808 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>>), default(IScheduler)));
19809 #else
19810 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15));
19811 #endif
19812 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<Unit>(
19813 Expression.Invoke(
19814 Expression.Call(
19815 null,
19816 m,
19817 Expression.Constant(provider, typeof(IQbservableProvider)),
19818 action,
19819 Expression.Constant(scheduler, typeof(IScheduler))
19820 ),
19821 Expression.Constant(t1, typeof(TArg1)),
19822 Expression.Constant(t2, typeof(TArg2)),
19823 Expression.Constant(t3, typeof(TArg3)),
19824 Expression.Constant(t4, typeof(TArg4)),
19825 Expression.Constant(t5, typeof(TArg5)),
19826 Expression.Constant(t6, typeof(TArg6)),
19827 Expression.Constant(t7, typeof(TArg7)),
19828 Expression.Constant(t8, typeof(TArg8)),
19829 Expression.Constant(t9, typeof(TArg9)),
19830 Expression.Constant(t10, typeof(TArg10)),
19831 Expression.Constant(t11, typeof(TArg11)),
19832 Expression.Constant(t12, typeof(TArg12)),
19833 Expression.Constant(t13, typeof(TArg13)),
19834 Expression.Constant(t14, typeof(TArg14)),
19835 Expression.Constant(t15, typeof(TArg15))
19836 )
19837 );
19838 }
19839
19840 /// <summary>
19841 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the default scheduler.
19842 /// </summary>
19843 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19844 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19845 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19846 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19847 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19848 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19849 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19850 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19851 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19852 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19853 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19854 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19855 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19856 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19857 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19858 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
19859 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
19860 /// <param name="action">Action to convert to an asynchronous action.</param>
19861 /// <returns>Asynchronous action.</returns>
19862 /// <exception cref="T:System.ArgumentNullException">
19863 /// <paramref name="action" /> is null.</exception>
19864 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>> action)
19865 {
19866 if (provider == null)
19867 throw new ArgumentNullException("provider");
19868 if (action == null)
19869 throw new ArgumentNullException("action");
19870
19871 #if CRIPPLED_REFLECTION
19872 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>>)));
19873 #else
19874 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16));
19875 #endif
19876 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<Unit>(
19877 Expression.Invoke(
19878 Expression.Call(
19879 null,
19880 m,
19881 Expression.Constant(provider, typeof(IQbservableProvider)),
19882 action
19883 ),
19884 Expression.Constant(t1, typeof(TArg1)),
19885 Expression.Constant(t2, typeof(TArg2)),
19886 Expression.Constant(t3, typeof(TArg3)),
19887 Expression.Constant(t4, typeof(TArg4)),
19888 Expression.Constant(t5, typeof(TArg5)),
19889 Expression.Constant(t6, typeof(TArg6)),
19890 Expression.Constant(t7, typeof(TArg7)),
19891 Expression.Constant(t8, typeof(TArg8)),
19892 Expression.Constant(t9, typeof(TArg9)),
19893 Expression.Constant(t10, typeof(TArg10)),
19894 Expression.Constant(t11, typeof(TArg11)),
19895 Expression.Constant(t12, typeof(TArg12)),
19896 Expression.Constant(t13, typeof(TArg13)),
19897 Expression.Constant(t14, typeof(TArg14)),
19898 Expression.Constant(t15, typeof(TArg15)),
19899 Expression.Constant(t16, typeof(TArg16))
19900 )
19901 );
19902 }
19903
19904 /// <summary>
19905 /// Converts the function into an asynchronous action. Each invocation of the resulting asynchronous action causes an invocation of the original synchronous action on the specified scheduler.
19906 /// </summary>
19907 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19908 /// <typeparam name="TArg1">The type of the first argument passed to the action.</typeparam>
19909 /// <typeparam name="TArg2">The type of the second argument passed to the action.</typeparam>
19910 /// <typeparam name="TArg3">The type of the third argument passed to the action.</typeparam>
19911 /// <typeparam name="TArg4">The type of the fourth argument passed to the action.</typeparam>
19912 /// <typeparam name="TArg5">The type of the fifth argument passed to the action.</typeparam>
19913 /// <typeparam name="TArg6">The type of the sixth argument passed to the action.</typeparam>
19914 /// <typeparam name="TArg7">The type of the seventh argument passed to the action.</typeparam>
19915 /// <typeparam name="TArg8">The type of the eighth argument passed to the action.</typeparam>
19916 /// <typeparam name="TArg9">The type of the ninth argument passed to the action.</typeparam>
19917 /// <typeparam name="TArg10">The type of the tenth argument passed to the action.</typeparam>
19918 /// <typeparam name="TArg11">The type of the eleventh argument passed to the action.</typeparam>
19919 /// <typeparam name="TArg12">The type of the twelfth argument passed to the action.</typeparam>
19920 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the action.</typeparam>
19921 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the action.</typeparam>
19922 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the action.</typeparam>
19923 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the action.</typeparam>
19924 /// <param name="action">Action to convert to an asynchronous action.</param>
19925 /// <param name="scheduler">Scheduler to invoke the original action on.</param>
19926 /// <returns>Asynchronous action.</returns>
19927 /// <exception cref="T:System.ArgumentNullException">
19928 /// <paramref name="action" /> or <paramref name="scheduler" /> is null.</exception>
19929 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<Unit>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(this IQbservableProvider provider, Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>> action, IScheduler scheduler)
19930 {
19931 if (provider == null)
19932 throw new ArgumentNullException("provider");
19933 if (action == null)
19934 throw new ArgumentNullException("action");
19935 if (scheduler == null)
19936 throw new ArgumentNullException("scheduler");
19937
19938 #if CRIPPLED_REFLECTION
19939 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>(default(IQbservableProvider), default(Expression<Action<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16>>), default(IScheduler)));
19940 #else
19941 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16));
19942 #endif
19943 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<Unit>(
19944 Expression.Invoke(
19945 Expression.Call(
19946 null,
19947 m,
19948 Expression.Constant(provider, typeof(IQbservableProvider)),
19949 action,
19950 Expression.Constant(scheduler, typeof(IScheduler))
19951 ),
19952 Expression.Constant(t1, typeof(TArg1)),
19953 Expression.Constant(t2, typeof(TArg2)),
19954 Expression.Constant(t3, typeof(TArg3)),
19955 Expression.Constant(t4, typeof(TArg4)),
19956 Expression.Constant(t5, typeof(TArg5)),
19957 Expression.Constant(t6, typeof(TArg6)),
19958 Expression.Constant(t7, typeof(TArg7)),
19959 Expression.Constant(t8, typeof(TArg8)),
19960 Expression.Constant(t9, typeof(TArg9)),
19961 Expression.Constant(t10, typeof(TArg10)),
19962 Expression.Constant(t11, typeof(TArg11)),
19963 Expression.Constant(t12, typeof(TArg12)),
19964 Expression.Constant(t13, typeof(TArg13)),
19965 Expression.Constant(t14, typeof(TArg14)),
19966 Expression.Constant(t15, typeof(TArg15)),
19967 Expression.Constant(t16, typeof(TArg16))
19968 )
19969 );
19970 }
19971
19972 #endif
19973 /// <summary>
19974 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
19975 /// </summary>
19976 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
19977 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
19978 /// <param name="function">Function to convert to an asynchronous function.</param>
19979 /// <returns>Asynchronous function.</returns>
19980 /// <exception cref="T:System.ArgumentNullException">
19981 /// <paramref name="function" /> is null.</exception>
19982 public static Func<IQbservable<TResult>> ToAsync<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function)
19983 {
19984 if (provider == null)
19985 throw new ArgumentNullException("provider");
19986 if (function == null)
19987 throw new ArgumentNullException("function");
19988
19989 #if CRIPPLED_REFLECTION
19990 var m = InfoOf(() => Qbservable.ToAsync<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>)));
19991 #else
19992 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
19993 #endif
19994 return () => provider.CreateQuery<TResult>(
19995 Expression.Invoke(
19996 Expression.Call(
19997 null,
19998 m,
19999 Expression.Constant(provider, typeof(IQbservableProvider)),
20000 function
20001 )
20002 )
20003 );
20004 }
20005
20006 /// <summary>
20007 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20008 /// </summary>
20009 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20010 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20011 /// <param name="function">Function to convert to an asynchronous function.</param>
20012 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20013 /// <returns>Asynchronous function.</returns>
20014 /// <exception cref="T:System.ArgumentNullException">
20015 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20016 public static Func<IQbservable<TResult>> ToAsync<TResult>(this IQbservableProvider provider, Expression<Func<TResult>> function, IScheduler scheduler)
20017 {
20018 if (provider == null)
20019 throw new ArgumentNullException("provider");
20020 if (function == null)
20021 throw new ArgumentNullException("function");
20022 if (scheduler == null)
20023 throw new ArgumentNullException("scheduler");
20024
20025 #if CRIPPLED_REFLECTION
20026 var m = InfoOf(() => Qbservable.ToAsync<TResult>(default(IQbservableProvider), default(Expression<Func<TResult>>), default(IScheduler)));
20027 #else
20028 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
20029 #endif
20030 return () => provider.CreateQuery<TResult>(
20031 Expression.Invoke(
20032 Expression.Call(
20033 null,
20034 m,
20035 Expression.Constant(provider, typeof(IQbservableProvider)),
20036 function,
20037 Expression.Constant(scheduler, typeof(IScheduler))
20038 )
20039 )
20040 );
20041 }
20042
20043 /// <summary>
20044 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20045 /// </summary>
20046 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20047 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20048 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20049 /// <param name="function">Function to convert to an asynchronous function.</param>
20050 /// <returns>Asynchronous function.</returns>
20051 /// <exception cref="T:System.ArgumentNullException">
20052 /// <paramref name="function" /> is null.</exception>
20053 public static Func<TArg1, IQbservable<TResult>> ToAsync<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TResult>> function)
20054 {
20055 if (provider == null)
20056 throw new ArgumentNullException("provider");
20057 if (function == null)
20058 throw new ArgumentNullException("function");
20059
20060 #if CRIPPLED_REFLECTION
20061 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TResult>>)));
20062 #else
20063 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
20064 #endif
20065 return (t1) => provider.CreateQuery<TResult>(
20066 Expression.Invoke(
20067 Expression.Call(
20068 null,
20069 m,
20070 Expression.Constant(provider, typeof(IQbservableProvider)),
20071 function
20072 ),
20073 Expression.Constant(t1, typeof(TArg1))
20074 )
20075 );
20076 }
20077
20078 /// <summary>
20079 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20080 /// </summary>
20081 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20082 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20083 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20084 /// <param name="function">Function to convert to an asynchronous function.</param>
20085 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20086 /// <returns>Asynchronous function.</returns>
20087 /// <exception cref="T:System.ArgumentNullException">
20088 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20089 public static Func<TArg1, IQbservable<TResult>> ToAsync<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TResult>> function, IScheduler scheduler)
20090 {
20091 if (provider == null)
20092 throw new ArgumentNullException("provider");
20093 if (function == null)
20094 throw new ArgumentNullException("function");
20095 if (scheduler == null)
20096 throw new ArgumentNullException("scheduler");
20097
20098 #if CRIPPLED_REFLECTION
20099 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TResult>>), default(IScheduler)));
20100 #else
20101 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
20102 #endif
20103 return (t1) => provider.CreateQuery<TResult>(
20104 Expression.Invoke(
20105 Expression.Call(
20106 null,
20107 m,
20108 Expression.Constant(provider, typeof(IQbservableProvider)),
20109 function,
20110 Expression.Constant(scheduler, typeof(IScheduler))
20111 ),
20112 Expression.Constant(t1, typeof(TArg1))
20113 )
20114 );
20115 }
20116
20117 /// <summary>
20118 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20119 /// </summary>
20120 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20121 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20122 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20123 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20124 /// <param name="function">Function to convert to an asynchronous function.</param>
20125 /// <returns>Asynchronous function.</returns>
20126 /// <exception cref="T:System.ArgumentNullException">
20127 /// <paramref name="function" /> is null.</exception>
20128 public static Func<TArg1, TArg2, IQbservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TResult>> function)
20129 {
20130 if (provider == null)
20131 throw new ArgumentNullException("provider");
20132 if (function == null)
20133 throw new ArgumentNullException("function");
20134
20135 #if CRIPPLED_REFLECTION
20136 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TResult>>)));
20137 #else
20138 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
20139 #endif
20140 return (t1, t2) => provider.CreateQuery<TResult>(
20141 Expression.Invoke(
20142 Expression.Call(
20143 null,
20144 m,
20145 Expression.Constant(provider, typeof(IQbservableProvider)),
20146 function
20147 ),
20148 Expression.Constant(t1, typeof(TArg1)),
20149 Expression.Constant(t2, typeof(TArg2))
20150 )
20151 );
20152 }
20153
20154 /// <summary>
20155 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20156 /// </summary>
20157 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20158 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20159 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20160 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20161 /// <param name="function">Function to convert to an asynchronous function.</param>
20162 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20163 /// <returns>Asynchronous function.</returns>
20164 /// <exception cref="T:System.ArgumentNullException">
20165 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20166 public static Func<TArg1, TArg2, IQbservable<TResult>> ToAsync<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TResult>> function, IScheduler scheduler)
20167 {
20168 if (provider == null)
20169 throw new ArgumentNullException("provider");
20170 if (function == null)
20171 throw new ArgumentNullException("function");
20172 if (scheduler == null)
20173 throw new ArgumentNullException("scheduler");
20174
20175 #if CRIPPLED_REFLECTION
20176 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TResult>>), default(IScheduler)));
20177 #else
20178 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
20179 #endif
20180 return (t1, t2) => provider.CreateQuery<TResult>(
20181 Expression.Invoke(
20182 Expression.Call(
20183 null,
20184 m,
20185 Expression.Constant(provider, typeof(IQbservableProvider)),
20186 function,
20187 Expression.Constant(scheduler, typeof(IScheduler))
20188 ),
20189 Expression.Constant(t1, typeof(TArg1)),
20190 Expression.Constant(t2, typeof(TArg2))
20191 )
20192 );
20193 }
20194
20195 /// <summary>
20196 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20197 /// </summary>
20198 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20199 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20200 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20201 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20202 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20203 /// <param name="function">Function to convert to an asynchronous function.</param>
20204 /// <returns>Asynchronous function.</returns>
20205 /// <exception cref="T:System.ArgumentNullException">
20206 /// <paramref name="function" /> is null.</exception>
20207 public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TResult>> function)
20208 {
20209 if (provider == null)
20210 throw new ArgumentNullException("provider");
20211 if (function == null)
20212 throw new ArgumentNullException("function");
20213
20214 #if CRIPPLED_REFLECTION
20215 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TResult>>)));
20216 #else
20217 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
20218 #endif
20219 return (t1, t2, t3) => provider.CreateQuery<TResult>(
20220 Expression.Invoke(
20221 Expression.Call(
20222 null,
20223 m,
20224 Expression.Constant(provider, typeof(IQbservableProvider)),
20225 function
20226 ),
20227 Expression.Constant(t1, typeof(TArg1)),
20228 Expression.Constant(t2, typeof(TArg2)),
20229 Expression.Constant(t3, typeof(TArg3))
20230 )
20231 );
20232 }
20233
20234 /// <summary>
20235 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20236 /// </summary>
20237 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20238 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20239 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20240 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20241 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20242 /// <param name="function">Function to convert to an asynchronous function.</param>
20243 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20244 /// <returns>Asynchronous function.</returns>
20245 /// <exception cref="T:System.ArgumentNullException">
20246 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20247 public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TResult>> function, IScheduler scheduler)
20248 {
20249 if (provider == null)
20250 throw new ArgumentNullException("provider");
20251 if (function == null)
20252 throw new ArgumentNullException("function");
20253 if (scheduler == null)
20254 throw new ArgumentNullException("scheduler");
20255
20256 #if CRIPPLED_REFLECTION
20257 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TResult>>), default(IScheduler)));
20258 #else
20259 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
20260 #endif
20261 return (t1, t2, t3) => provider.CreateQuery<TResult>(
20262 Expression.Invoke(
20263 Expression.Call(
20264 null,
20265 m,
20266 Expression.Constant(provider, typeof(IQbservableProvider)),
20267 function,
20268 Expression.Constant(scheduler, typeof(IScheduler))
20269 ),
20270 Expression.Constant(t1, typeof(TArg1)),
20271 Expression.Constant(t2, typeof(TArg2)),
20272 Expression.Constant(t3, typeof(TArg3))
20273 )
20274 );
20275 }
20276
20277 /// <summary>
20278 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20279 /// </summary>
20280 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20281 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20282 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20283 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20284 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20285 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20286 /// <param name="function">Function to convert to an asynchronous function.</param>
20287 /// <returns>Asynchronous function.</returns>
20288 /// <exception cref="T:System.ArgumentNullException">
20289 /// <paramref name="function" /> is null.</exception>
20290 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>> function)
20291 {
20292 if (provider == null)
20293 throw new ArgumentNullException("provider");
20294 if (function == null)
20295 throw new ArgumentNullException("function");
20296
20297 #if CRIPPLED_REFLECTION
20298 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>>)));
20299 #else
20300 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
20301 #endif
20302 return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
20303 Expression.Invoke(
20304 Expression.Call(
20305 null,
20306 m,
20307 Expression.Constant(provider, typeof(IQbservableProvider)),
20308 function
20309 ),
20310 Expression.Constant(t1, typeof(TArg1)),
20311 Expression.Constant(t2, typeof(TArg2)),
20312 Expression.Constant(t3, typeof(TArg3)),
20313 Expression.Constant(t4, typeof(TArg4))
20314 )
20315 );
20316 }
20317
20318 /// <summary>
20319 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20320 /// </summary>
20321 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20322 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20323 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20324 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20325 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20326 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20327 /// <param name="function">Function to convert to an asynchronous function.</param>
20328 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20329 /// <returns>Asynchronous function.</returns>
20330 /// <exception cref="T:System.ArgumentNullException">
20331 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20332 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>> function, IScheduler scheduler)
20333 {
20334 if (provider == null)
20335 throw new ArgumentNullException("provider");
20336 if (function == null)
20337 throw new ArgumentNullException("function");
20338 if (scheduler == null)
20339 throw new ArgumentNullException("scheduler");
20340
20341 #if CRIPPLED_REFLECTION
20342 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TResult>>), default(IScheduler)));
20343 #else
20344 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
20345 #endif
20346 return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
20347 Expression.Invoke(
20348 Expression.Call(
20349 null,
20350 m,
20351 Expression.Constant(provider, typeof(IQbservableProvider)),
20352 function,
20353 Expression.Constant(scheduler, typeof(IScheduler))
20354 ),
20355 Expression.Constant(t1, typeof(TArg1)),
20356 Expression.Constant(t2, typeof(TArg2)),
20357 Expression.Constant(t3, typeof(TArg3)),
20358 Expression.Constant(t4, typeof(TArg4))
20359 )
20360 );
20361 }
20362
20363 #if !NO_LARGEARITY
20364 /// <summary>
20365 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20366 /// </summary>
20367 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20368 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20369 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20370 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20371 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20372 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20373 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20374 /// <param name="function">Function to convert to an asynchronous function.</param>
20375 /// <returns>Asynchronous function.</returns>
20376 /// <exception cref="T:System.ArgumentNullException">
20377 /// <paramref name="function" /> is null.</exception>
20378 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>> function)
20379 {
20380 if (provider == null)
20381 throw new ArgumentNullException("provider");
20382 if (function == null)
20383 throw new ArgumentNullException("function");
20384
20385 #if CRIPPLED_REFLECTION
20386 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>)));
20387 #else
20388 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
20389 #endif
20390 return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
20391 Expression.Invoke(
20392 Expression.Call(
20393 null,
20394 m,
20395 Expression.Constant(provider, typeof(IQbservableProvider)),
20396 function
20397 ),
20398 Expression.Constant(t1, typeof(TArg1)),
20399 Expression.Constant(t2, typeof(TArg2)),
20400 Expression.Constant(t3, typeof(TArg3)),
20401 Expression.Constant(t4, typeof(TArg4)),
20402 Expression.Constant(t5, typeof(TArg5))
20403 )
20404 );
20405 }
20406
20407 /// <summary>
20408 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20409 /// </summary>
20410 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20411 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20412 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20413 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20414 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20415 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20416 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20417 /// <param name="function">Function to convert to an asynchronous function.</param>
20418 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20419 /// <returns>Asynchronous function.</returns>
20420 /// <exception cref="T:System.ArgumentNullException">
20421 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20422 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>> function, IScheduler scheduler)
20423 {
20424 if (provider == null)
20425 throw new ArgumentNullException("provider");
20426 if (function == null)
20427 throw new ArgumentNullException("function");
20428 if (scheduler == null)
20429 throw new ArgumentNullException("scheduler");
20430
20431 #if CRIPPLED_REFLECTION
20432 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>>), default(IScheduler)));
20433 #else
20434 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
20435 #endif
20436 return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
20437 Expression.Invoke(
20438 Expression.Call(
20439 null,
20440 m,
20441 Expression.Constant(provider, typeof(IQbservableProvider)),
20442 function,
20443 Expression.Constant(scheduler, typeof(IScheduler))
20444 ),
20445 Expression.Constant(t1, typeof(TArg1)),
20446 Expression.Constant(t2, typeof(TArg2)),
20447 Expression.Constant(t3, typeof(TArg3)),
20448 Expression.Constant(t4, typeof(TArg4)),
20449 Expression.Constant(t5, typeof(TArg5))
20450 )
20451 );
20452 }
20453
20454 /// <summary>
20455 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20456 /// </summary>
20457 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20458 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20459 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20460 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20461 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20462 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20463 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20464 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20465 /// <param name="function">Function to convert to an asynchronous function.</param>
20466 /// <returns>Asynchronous function.</returns>
20467 /// <exception cref="T:System.ArgumentNullException">
20468 /// <paramref name="function" /> is null.</exception>
20469 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>> function)
20470 {
20471 if (provider == null)
20472 throw new ArgumentNullException("provider");
20473 if (function == null)
20474 throw new ArgumentNullException("function");
20475
20476 #if CRIPPLED_REFLECTION
20477 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>>)));
20478 #else
20479 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
20480 #endif
20481 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
20482 Expression.Invoke(
20483 Expression.Call(
20484 null,
20485 m,
20486 Expression.Constant(provider, typeof(IQbservableProvider)),
20487 function
20488 ),
20489 Expression.Constant(t1, typeof(TArg1)),
20490 Expression.Constant(t2, typeof(TArg2)),
20491 Expression.Constant(t3, typeof(TArg3)),
20492 Expression.Constant(t4, typeof(TArg4)),
20493 Expression.Constant(t5, typeof(TArg5)),
20494 Expression.Constant(t6, typeof(TArg6))
20495 )
20496 );
20497 }
20498
20499 /// <summary>
20500 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20501 /// </summary>
20502 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20503 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20504 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20505 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20506 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20507 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20508 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20509 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20510 /// <param name="function">Function to convert to an asynchronous function.</param>
20511 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20512 /// <returns>Asynchronous function.</returns>
20513 /// <exception cref="T:System.ArgumentNullException">
20514 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20515 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>> function, IScheduler scheduler)
20516 {
20517 if (provider == null)
20518 throw new ArgumentNullException("provider");
20519 if (function == null)
20520 throw new ArgumentNullException("function");
20521 if (scheduler == null)
20522 throw new ArgumentNullException("scheduler");
20523
20524 #if CRIPPLED_REFLECTION
20525 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>>), default(IScheduler)));
20526 #else
20527 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
20528 #endif
20529 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
20530 Expression.Invoke(
20531 Expression.Call(
20532 null,
20533 m,
20534 Expression.Constant(provider, typeof(IQbservableProvider)),
20535 function,
20536 Expression.Constant(scheduler, typeof(IScheduler))
20537 ),
20538 Expression.Constant(t1, typeof(TArg1)),
20539 Expression.Constant(t2, typeof(TArg2)),
20540 Expression.Constant(t3, typeof(TArg3)),
20541 Expression.Constant(t4, typeof(TArg4)),
20542 Expression.Constant(t5, typeof(TArg5)),
20543 Expression.Constant(t6, typeof(TArg6))
20544 )
20545 );
20546 }
20547
20548 /// <summary>
20549 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20550 /// </summary>
20551 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20552 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20553 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20554 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20555 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20556 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20557 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20558 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20559 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20560 /// <param name="function">Function to convert to an asynchronous function.</param>
20561 /// <returns>Asynchronous function.</returns>
20562 /// <exception cref="T:System.ArgumentNullException">
20563 /// <paramref name="function" /> is null.</exception>
20564 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>> function)
20565 {
20566 if (provider == null)
20567 throw new ArgumentNullException("provider");
20568 if (function == null)
20569 throw new ArgumentNullException("function");
20570
20571 #if CRIPPLED_REFLECTION
20572 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>>)));
20573 #else
20574 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
20575 #endif
20576 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
20577 Expression.Invoke(
20578 Expression.Call(
20579 null,
20580 m,
20581 Expression.Constant(provider, typeof(IQbservableProvider)),
20582 function
20583 ),
20584 Expression.Constant(t1, typeof(TArg1)),
20585 Expression.Constant(t2, typeof(TArg2)),
20586 Expression.Constant(t3, typeof(TArg3)),
20587 Expression.Constant(t4, typeof(TArg4)),
20588 Expression.Constant(t5, typeof(TArg5)),
20589 Expression.Constant(t6, typeof(TArg6)),
20590 Expression.Constant(t7, typeof(TArg7))
20591 )
20592 );
20593 }
20594
20595 /// <summary>
20596 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20597 /// </summary>
20598 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20599 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20600 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20601 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20602 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20603 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20604 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20605 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20606 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20607 /// <param name="function">Function to convert to an asynchronous function.</param>
20608 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20609 /// <returns>Asynchronous function.</returns>
20610 /// <exception cref="T:System.ArgumentNullException">
20611 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20612 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>> function, IScheduler scheduler)
20613 {
20614 if (provider == null)
20615 throw new ArgumentNullException("provider");
20616 if (function == null)
20617 throw new ArgumentNullException("function");
20618 if (scheduler == null)
20619 throw new ArgumentNullException("scheduler");
20620
20621 #if CRIPPLED_REFLECTION
20622 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>>), default(IScheduler)));
20623 #else
20624 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
20625 #endif
20626 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
20627 Expression.Invoke(
20628 Expression.Call(
20629 null,
20630 m,
20631 Expression.Constant(provider, typeof(IQbservableProvider)),
20632 function,
20633 Expression.Constant(scheduler, typeof(IScheduler))
20634 ),
20635 Expression.Constant(t1, typeof(TArg1)),
20636 Expression.Constant(t2, typeof(TArg2)),
20637 Expression.Constant(t3, typeof(TArg3)),
20638 Expression.Constant(t4, typeof(TArg4)),
20639 Expression.Constant(t5, typeof(TArg5)),
20640 Expression.Constant(t6, typeof(TArg6)),
20641 Expression.Constant(t7, typeof(TArg7))
20642 )
20643 );
20644 }
20645
20646 /// <summary>
20647 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20648 /// </summary>
20649 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20650 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20651 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20652 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20653 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20654 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20655 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20656 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20657 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20658 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20659 /// <param name="function">Function to convert to an asynchronous function.</param>
20660 /// <returns>Asynchronous function.</returns>
20661 /// <exception cref="T:System.ArgumentNullException">
20662 /// <paramref name="function" /> is null.</exception>
20663 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>> function)
20664 {
20665 if (provider == null)
20666 throw new ArgumentNullException("provider");
20667 if (function == null)
20668 throw new ArgumentNullException("function");
20669
20670 #if CRIPPLED_REFLECTION
20671 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>>)));
20672 #else
20673 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
20674 #endif
20675 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
20676 Expression.Invoke(
20677 Expression.Call(
20678 null,
20679 m,
20680 Expression.Constant(provider, typeof(IQbservableProvider)),
20681 function
20682 ),
20683 Expression.Constant(t1, typeof(TArg1)),
20684 Expression.Constant(t2, typeof(TArg2)),
20685 Expression.Constant(t3, typeof(TArg3)),
20686 Expression.Constant(t4, typeof(TArg4)),
20687 Expression.Constant(t5, typeof(TArg5)),
20688 Expression.Constant(t6, typeof(TArg6)),
20689 Expression.Constant(t7, typeof(TArg7)),
20690 Expression.Constant(t8, typeof(TArg8))
20691 )
20692 );
20693 }
20694
20695 /// <summary>
20696 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20697 /// </summary>
20698 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20699 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20700 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20701 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20702 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20703 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20704 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20705 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20706 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20707 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20708 /// <param name="function">Function to convert to an asynchronous function.</param>
20709 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20710 /// <returns>Asynchronous function.</returns>
20711 /// <exception cref="T:System.ArgumentNullException">
20712 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20713 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>> function, IScheduler scheduler)
20714 {
20715 if (provider == null)
20716 throw new ArgumentNullException("provider");
20717 if (function == null)
20718 throw new ArgumentNullException("function");
20719 if (scheduler == null)
20720 throw new ArgumentNullException("scheduler");
20721
20722 #if CRIPPLED_REFLECTION
20723 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>>), default(IScheduler)));
20724 #else
20725 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
20726 #endif
20727 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
20728 Expression.Invoke(
20729 Expression.Call(
20730 null,
20731 m,
20732 Expression.Constant(provider, typeof(IQbservableProvider)),
20733 function,
20734 Expression.Constant(scheduler, typeof(IScheduler))
20735 ),
20736 Expression.Constant(t1, typeof(TArg1)),
20737 Expression.Constant(t2, typeof(TArg2)),
20738 Expression.Constant(t3, typeof(TArg3)),
20739 Expression.Constant(t4, typeof(TArg4)),
20740 Expression.Constant(t5, typeof(TArg5)),
20741 Expression.Constant(t6, typeof(TArg6)),
20742 Expression.Constant(t7, typeof(TArg7)),
20743 Expression.Constant(t8, typeof(TArg8))
20744 )
20745 );
20746 }
20747
20748 /// <summary>
20749 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20750 /// </summary>
20751 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20752 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20753 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20754 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20755 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20756 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20757 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20758 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20759 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20760 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
20761 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20762 /// <param name="function">Function to convert to an asynchronous function.</param>
20763 /// <returns>Asynchronous function.</returns>
20764 /// <exception cref="T:System.ArgumentNullException">
20765 /// <paramref name="function" /> is null.</exception>
20766 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>> function)
20767 {
20768 if (provider == null)
20769 throw new ArgumentNullException("provider");
20770 if (function == null)
20771 throw new ArgumentNullException("function");
20772
20773 #if CRIPPLED_REFLECTION
20774 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>>)));
20775 #else
20776 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
20777 #endif
20778 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
20779 Expression.Invoke(
20780 Expression.Call(
20781 null,
20782 m,
20783 Expression.Constant(provider, typeof(IQbservableProvider)),
20784 function
20785 ),
20786 Expression.Constant(t1, typeof(TArg1)),
20787 Expression.Constant(t2, typeof(TArg2)),
20788 Expression.Constant(t3, typeof(TArg3)),
20789 Expression.Constant(t4, typeof(TArg4)),
20790 Expression.Constant(t5, typeof(TArg5)),
20791 Expression.Constant(t6, typeof(TArg6)),
20792 Expression.Constant(t7, typeof(TArg7)),
20793 Expression.Constant(t8, typeof(TArg8)),
20794 Expression.Constant(t9, typeof(TArg9))
20795 )
20796 );
20797 }
20798
20799 /// <summary>
20800 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20801 /// </summary>
20802 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20803 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20804 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20805 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20806 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20807 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20808 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20809 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20810 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20811 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
20812 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20813 /// <param name="function">Function to convert to an asynchronous function.</param>
20814 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20815 /// <returns>Asynchronous function.</returns>
20816 /// <exception cref="T:System.ArgumentNullException">
20817 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20818 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>> function, IScheduler scheduler)
20819 {
20820 if (provider == null)
20821 throw new ArgumentNullException("provider");
20822 if (function == null)
20823 throw new ArgumentNullException("function");
20824 if (scheduler == null)
20825 throw new ArgumentNullException("scheduler");
20826
20827 #if CRIPPLED_REFLECTION
20828 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>>), default(IScheduler)));
20829 #else
20830 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
20831 #endif
20832 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
20833 Expression.Invoke(
20834 Expression.Call(
20835 null,
20836 m,
20837 Expression.Constant(provider, typeof(IQbservableProvider)),
20838 function,
20839 Expression.Constant(scheduler, typeof(IScheduler))
20840 ),
20841 Expression.Constant(t1, typeof(TArg1)),
20842 Expression.Constant(t2, typeof(TArg2)),
20843 Expression.Constant(t3, typeof(TArg3)),
20844 Expression.Constant(t4, typeof(TArg4)),
20845 Expression.Constant(t5, typeof(TArg5)),
20846 Expression.Constant(t6, typeof(TArg6)),
20847 Expression.Constant(t7, typeof(TArg7)),
20848 Expression.Constant(t8, typeof(TArg8)),
20849 Expression.Constant(t9, typeof(TArg9))
20850 )
20851 );
20852 }
20853
20854 /// <summary>
20855 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20856 /// </summary>
20857 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20858 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20859 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20860 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20861 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20862 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20863 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20864 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20865 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20866 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
20867 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
20868 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20869 /// <param name="function">Function to convert to an asynchronous function.</param>
20870 /// <returns>Asynchronous function.</returns>
20871 /// <exception cref="T:System.ArgumentNullException">
20872 /// <paramref name="function" /> is null.</exception>
20873 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>> function)
20874 {
20875 if (provider == null)
20876 throw new ArgumentNullException("provider");
20877 if (function == null)
20878 throw new ArgumentNullException("function");
20879
20880 #if CRIPPLED_REFLECTION
20881 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>>)));
20882 #else
20883 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
20884 #endif
20885 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
20886 Expression.Invoke(
20887 Expression.Call(
20888 null,
20889 m,
20890 Expression.Constant(provider, typeof(IQbservableProvider)),
20891 function
20892 ),
20893 Expression.Constant(t1, typeof(TArg1)),
20894 Expression.Constant(t2, typeof(TArg2)),
20895 Expression.Constant(t3, typeof(TArg3)),
20896 Expression.Constant(t4, typeof(TArg4)),
20897 Expression.Constant(t5, typeof(TArg5)),
20898 Expression.Constant(t6, typeof(TArg6)),
20899 Expression.Constant(t7, typeof(TArg7)),
20900 Expression.Constant(t8, typeof(TArg8)),
20901 Expression.Constant(t9, typeof(TArg9)),
20902 Expression.Constant(t10, typeof(TArg10))
20903 )
20904 );
20905 }
20906
20907 /// <summary>
20908 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
20909 /// </summary>
20910 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20911 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20912 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20913 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20914 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20915 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20916 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20917 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20918 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20919 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
20920 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
20921 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20922 /// <param name="function">Function to convert to an asynchronous function.</param>
20923 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
20924 /// <returns>Asynchronous function.</returns>
20925 /// <exception cref="T:System.ArgumentNullException">
20926 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
20927 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>> function, IScheduler scheduler)
20928 {
20929 if (provider == null)
20930 throw new ArgumentNullException("provider");
20931 if (function == null)
20932 throw new ArgumentNullException("function");
20933 if (scheduler == null)
20934 throw new ArgumentNullException("scheduler");
20935
20936 #if CRIPPLED_REFLECTION
20937 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>>), default(IScheduler)));
20938 #else
20939 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
20940 #endif
20941 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
20942 Expression.Invoke(
20943 Expression.Call(
20944 null,
20945 m,
20946 Expression.Constant(provider, typeof(IQbservableProvider)),
20947 function,
20948 Expression.Constant(scheduler, typeof(IScheduler))
20949 ),
20950 Expression.Constant(t1, typeof(TArg1)),
20951 Expression.Constant(t2, typeof(TArg2)),
20952 Expression.Constant(t3, typeof(TArg3)),
20953 Expression.Constant(t4, typeof(TArg4)),
20954 Expression.Constant(t5, typeof(TArg5)),
20955 Expression.Constant(t6, typeof(TArg6)),
20956 Expression.Constant(t7, typeof(TArg7)),
20957 Expression.Constant(t8, typeof(TArg8)),
20958 Expression.Constant(t9, typeof(TArg9)),
20959 Expression.Constant(t10, typeof(TArg10))
20960 )
20961 );
20962 }
20963
20964 /// <summary>
20965 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
20966 /// </summary>
20967 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
20968 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
20969 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
20970 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
20971 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
20972 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
20973 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
20974 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
20975 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
20976 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
20977 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
20978 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
20979 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
20980 /// <param name="function">Function to convert to an asynchronous function.</param>
20981 /// <returns>Asynchronous function.</returns>
20982 /// <exception cref="T:System.ArgumentNullException">
20983 /// <paramref name="function" /> is null.</exception>
20984 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>> function)
20985 {
20986 if (provider == null)
20987 throw new ArgumentNullException("provider");
20988 if (function == null)
20989 throw new ArgumentNullException("function");
20990
20991 #if CRIPPLED_REFLECTION
20992 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>>)));
20993 #else
20994 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
20995 #endif
20996 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
20997 Expression.Invoke(
20998 Expression.Call(
20999 null,
21000 m,
21001 Expression.Constant(provider, typeof(IQbservableProvider)),
21002 function
21003 ),
21004 Expression.Constant(t1, typeof(TArg1)),
21005 Expression.Constant(t2, typeof(TArg2)),
21006 Expression.Constant(t3, typeof(TArg3)),
21007 Expression.Constant(t4, typeof(TArg4)),
21008 Expression.Constant(t5, typeof(TArg5)),
21009 Expression.Constant(t6, typeof(TArg6)),
21010 Expression.Constant(t7, typeof(TArg7)),
21011 Expression.Constant(t8, typeof(TArg8)),
21012 Expression.Constant(t9, typeof(TArg9)),
21013 Expression.Constant(t10, typeof(TArg10)),
21014 Expression.Constant(t11, typeof(TArg11))
21015 )
21016 );
21017 }
21018
21019 /// <summary>
21020 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21021 /// </summary>
21022 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21023 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21024 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21025 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21026 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21027 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21028 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21029 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21030 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21031 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21032 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21033 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21034 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21035 /// <param name="function">Function to convert to an asynchronous function.</param>
21036 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21037 /// <returns>Asynchronous function.</returns>
21038 /// <exception cref="T:System.ArgumentNullException">
21039 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21040 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>> function, IScheduler scheduler)
21041 {
21042 if (provider == null)
21043 throw new ArgumentNullException("provider");
21044 if (function == null)
21045 throw new ArgumentNullException("function");
21046 if (scheduler == null)
21047 throw new ArgumentNullException("scheduler");
21048
21049 #if CRIPPLED_REFLECTION
21050 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>>), default(IScheduler)));
21051 #else
21052 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
21053 #endif
21054 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
21055 Expression.Invoke(
21056 Expression.Call(
21057 null,
21058 m,
21059 Expression.Constant(provider, typeof(IQbservableProvider)),
21060 function,
21061 Expression.Constant(scheduler, typeof(IScheduler))
21062 ),
21063 Expression.Constant(t1, typeof(TArg1)),
21064 Expression.Constant(t2, typeof(TArg2)),
21065 Expression.Constant(t3, typeof(TArg3)),
21066 Expression.Constant(t4, typeof(TArg4)),
21067 Expression.Constant(t5, typeof(TArg5)),
21068 Expression.Constant(t6, typeof(TArg6)),
21069 Expression.Constant(t7, typeof(TArg7)),
21070 Expression.Constant(t8, typeof(TArg8)),
21071 Expression.Constant(t9, typeof(TArg9)),
21072 Expression.Constant(t10, typeof(TArg10)),
21073 Expression.Constant(t11, typeof(TArg11))
21074 )
21075 );
21076 }
21077
21078 /// <summary>
21079 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
21080 /// </summary>
21081 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21082 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21083 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21084 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21085 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21086 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21087 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21088 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21089 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21090 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21091 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21092 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21093 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21094 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21095 /// <param name="function">Function to convert to an asynchronous function.</param>
21096 /// <returns>Asynchronous function.</returns>
21097 /// <exception cref="T:System.ArgumentNullException">
21098 /// <paramref name="function" /> is null.</exception>
21099 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>> function)
21100 {
21101 if (provider == null)
21102 throw new ArgumentNullException("provider");
21103 if (function == null)
21104 throw new ArgumentNullException("function");
21105
21106 #if CRIPPLED_REFLECTION
21107 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>>)));
21108 #else
21109 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
21110 #endif
21111 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
21112 Expression.Invoke(
21113 Expression.Call(
21114 null,
21115 m,
21116 Expression.Constant(provider, typeof(IQbservableProvider)),
21117 function
21118 ),
21119 Expression.Constant(t1, typeof(TArg1)),
21120 Expression.Constant(t2, typeof(TArg2)),
21121 Expression.Constant(t3, typeof(TArg3)),
21122 Expression.Constant(t4, typeof(TArg4)),
21123 Expression.Constant(t5, typeof(TArg5)),
21124 Expression.Constant(t6, typeof(TArg6)),
21125 Expression.Constant(t7, typeof(TArg7)),
21126 Expression.Constant(t8, typeof(TArg8)),
21127 Expression.Constant(t9, typeof(TArg9)),
21128 Expression.Constant(t10, typeof(TArg10)),
21129 Expression.Constant(t11, typeof(TArg11)),
21130 Expression.Constant(t12, typeof(TArg12))
21131 )
21132 );
21133 }
21134
21135 /// <summary>
21136 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21137 /// </summary>
21138 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21139 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21140 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21141 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21142 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21143 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21144 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21145 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21146 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21147 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21148 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21149 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21150 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21151 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21152 /// <param name="function">Function to convert to an asynchronous function.</param>
21153 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21154 /// <returns>Asynchronous function.</returns>
21155 /// <exception cref="T:System.ArgumentNullException">
21156 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21157 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>> function, IScheduler scheduler)
21158 {
21159 if (provider == null)
21160 throw new ArgumentNullException("provider");
21161 if (function == null)
21162 throw new ArgumentNullException("function");
21163 if (scheduler == null)
21164 throw new ArgumentNullException("scheduler");
21165
21166 #if CRIPPLED_REFLECTION
21167 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>>), default(IScheduler)));
21168 #else
21169 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
21170 #endif
21171 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
21172 Expression.Invoke(
21173 Expression.Call(
21174 null,
21175 m,
21176 Expression.Constant(provider, typeof(IQbservableProvider)),
21177 function,
21178 Expression.Constant(scheduler, typeof(IScheduler))
21179 ),
21180 Expression.Constant(t1, typeof(TArg1)),
21181 Expression.Constant(t2, typeof(TArg2)),
21182 Expression.Constant(t3, typeof(TArg3)),
21183 Expression.Constant(t4, typeof(TArg4)),
21184 Expression.Constant(t5, typeof(TArg5)),
21185 Expression.Constant(t6, typeof(TArg6)),
21186 Expression.Constant(t7, typeof(TArg7)),
21187 Expression.Constant(t8, typeof(TArg8)),
21188 Expression.Constant(t9, typeof(TArg9)),
21189 Expression.Constant(t10, typeof(TArg10)),
21190 Expression.Constant(t11, typeof(TArg11)),
21191 Expression.Constant(t12, typeof(TArg12))
21192 )
21193 );
21194 }
21195
21196 /// <summary>
21197 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
21198 /// </summary>
21199 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21200 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21201 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21202 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21203 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21204 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21205 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21206 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21207 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21208 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21209 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21210 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21211 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21212 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21213 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21214 /// <param name="function">Function to convert to an asynchronous function.</param>
21215 /// <returns>Asynchronous function.</returns>
21216 /// <exception cref="T:System.ArgumentNullException">
21217 /// <paramref name="function" /> is null.</exception>
21218 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>> function)
21219 {
21220 if (provider == null)
21221 throw new ArgumentNullException("provider");
21222 if (function == null)
21223 throw new ArgumentNullException("function");
21224
21225 #if CRIPPLED_REFLECTION
21226 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>>)));
21227 #else
21228 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
21229 #endif
21230 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
21231 Expression.Invoke(
21232 Expression.Call(
21233 null,
21234 m,
21235 Expression.Constant(provider, typeof(IQbservableProvider)),
21236 function
21237 ),
21238 Expression.Constant(t1, typeof(TArg1)),
21239 Expression.Constant(t2, typeof(TArg2)),
21240 Expression.Constant(t3, typeof(TArg3)),
21241 Expression.Constant(t4, typeof(TArg4)),
21242 Expression.Constant(t5, typeof(TArg5)),
21243 Expression.Constant(t6, typeof(TArg6)),
21244 Expression.Constant(t7, typeof(TArg7)),
21245 Expression.Constant(t8, typeof(TArg8)),
21246 Expression.Constant(t9, typeof(TArg9)),
21247 Expression.Constant(t10, typeof(TArg10)),
21248 Expression.Constant(t11, typeof(TArg11)),
21249 Expression.Constant(t12, typeof(TArg12)),
21250 Expression.Constant(t13, typeof(TArg13))
21251 )
21252 );
21253 }
21254
21255 /// <summary>
21256 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21257 /// </summary>
21258 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21259 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21260 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21261 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21262 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21263 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21264 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21265 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21266 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21267 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21268 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21269 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21270 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21271 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21272 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21273 /// <param name="function">Function to convert to an asynchronous function.</param>
21274 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21275 /// <returns>Asynchronous function.</returns>
21276 /// <exception cref="T:System.ArgumentNullException">
21277 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21278 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>> function, IScheduler scheduler)
21279 {
21280 if (provider == null)
21281 throw new ArgumentNullException("provider");
21282 if (function == null)
21283 throw new ArgumentNullException("function");
21284 if (scheduler == null)
21285 throw new ArgumentNullException("scheduler");
21286
21287 #if CRIPPLED_REFLECTION
21288 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>>), default(IScheduler)));
21289 #else
21290 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
21291 #endif
21292 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
21293 Expression.Invoke(
21294 Expression.Call(
21295 null,
21296 m,
21297 Expression.Constant(provider, typeof(IQbservableProvider)),
21298 function,
21299 Expression.Constant(scheduler, typeof(IScheduler))
21300 ),
21301 Expression.Constant(t1, typeof(TArg1)),
21302 Expression.Constant(t2, typeof(TArg2)),
21303 Expression.Constant(t3, typeof(TArg3)),
21304 Expression.Constant(t4, typeof(TArg4)),
21305 Expression.Constant(t5, typeof(TArg5)),
21306 Expression.Constant(t6, typeof(TArg6)),
21307 Expression.Constant(t7, typeof(TArg7)),
21308 Expression.Constant(t8, typeof(TArg8)),
21309 Expression.Constant(t9, typeof(TArg9)),
21310 Expression.Constant(t10, typeof(TArg10)),
21311 Expression.Constant(t11, typeof(TArg11)),
21312 Expression.Constant(t12, typeof(TArg12)),
21313 Expression.Constant(t13, typeof(TArg13))
21314 )
21315 );
21316 }
21317
21318 /// <summary>
21319 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
21320 /// </summary>
21321 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21322 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21323 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21324 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21325 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21326 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21327 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21328 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21329 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21330 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21331 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21332 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21333 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21334 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21335 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21336 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21337 /// <param name="function">Function to convert to an asynchronous function.</param>
21338 /// <returns>Asynchronous function.</returns>
21339 /// <exception cref="T:System.ArgumentNullException">
21340 /// <paramref name="function" /> is null.</exception>
21341 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>> function)
21342 {
21343 if (provider == null)
21344 throw new ArgumentNullException("provider");
21345 if (function == null)
21346 throw new ArgumentNullException("function");
21347
21348 #if CRIPPLED_REFLECTION
21349 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>>)));
21350 #else
21351 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
21352 #endif
21353 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
21354 Expression.Invoke(
21355 Expression.Call(
21356 null,
21357 m,
21358 Expression.Constant(provider, typeof(IQbservableProvider)),
21359 function
21360 ),
21361 Expression.Constant(t1, typeof(TArg1)),
21362 Expression.Constant(t2, typeof(TArg2)),
21363 Expression.Constant(t3, typeof(TArg3)),
21364 Expression.Constant(t4, typeof(TArg4)),
21365 Expression.Constant(t5, typeof(TArg5)),
21366 Expression.Constant(t6, typeof(TArg6)),
21367 Expression.Constant(t7, typeof(TArg7)),
21368 Expression.Constant(t8, typeof(TArg8)),
21369 Expression.Constant(t9, typeof(TArg9)),
21370 Expression.Constant(t10, typeof(TArg10)),
21371 Expression.Constant(t11, typeof(TArg11)),
21372 Expression.Constant(t12, typeof(TArg12)),
21373 Expression.Constant(t13, typeof(TArg13)),
21374 Expression.Constant(t14, typeof(TArg14))
21375 )
21376 );
21377 }
21378
21379 /// <summary>
21380 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21381 /// </summary>
21382 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21383 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21384 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21385 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21386 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21387 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21388 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21389 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21390 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21391 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21392 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21393 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21394 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21395 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21396 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21397 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21398 /// <param name="function">Function to convert to an asynchronous function.</param>
21399 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21400 /// <returns>Asynchronous function.</returns>
21401 /// <exception cref="T:System.ArgumentNullException">
21402 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21403 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>> function, IScheduler scheduler)
21404 {
21405 if (provider == null)
21406 throw new ArgumentNullException("provider");
21407 if (function == null)
21408 throw new ArgumentNullException("function");
21409 if (scheduler == null)
21410 throw new ArgumentNullException("scheduler");
21411
21412 #if CRIPPLED_REFLECTION
21413 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>>), default(IScheduler)));
21414 #else
21415 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
21416 #endif
21417 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
21418 Expression.Invoke(
21419 Expression.Call(
21420 null,
21421 m,
21422 Expression.Constant(provider, typeof(IQbservableProvider)),
21423 function,
21424 Expression.Constant(scheduler, typeof(IScheduler))
21425 ),
21426 Expression.Constant(t1, typeof(TArg1)),
21427 Expression.Constant(t2, typeof(TArg2)),
21428 Expression.Constant(t3, typeof(TArg3)),
21429 Expression.Constant(t4, typeof(TArg4)),
21430 Expression.Constant(t5, typeof(TArg5)),
21431 Expression.Constant(t6, typeof(TArg6)),
21432 Expression.Constant(t7, typeof(TArg7)),
21433 Expression.Constant(t8, typeof(TArg8)),
21434 Expression.Constant(t9, typeof(TArg9)),
21435 Expression.Constant(t10, typeof(TArg10)),
21436 Expression.Constant(t11, typeof(TArg11)),
21437 Expression.Constant(t12, typeof(TArg12)),
21438 Expression.Constant(t13, typeof(TArg13)),
21439 Expression.Constant(t14, typeof(TArg14))
21440 )
21441 );
21442 }
21443
21444 /// <summary>
21445 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
21446 /// </summary>
21447 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21448 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21449 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21450 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21451 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21452 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21453 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21454 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21455 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21456 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21457 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21458 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21459 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21460 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21461 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21462 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
21463 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21464 /// <param name="function">Function to convert to an asynchronous function.</param>
21465 /// <returns>Asynchronous function.</returns>
21466 /// <exception cref="T:System.ArgumentNullException">
21467 /// <paramref name="function" /> is null.</exception>
21468 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>> function)
21469 {
21470 if (provider == null)
21471 throw new ArgumentNullException("provider");
21472 if (function == null)
21473 throw new ArgumentNullException("function");
21474
21475 #if CRIPPLED_REFLECTION
21476 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>>)));
21477 #else
21478 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TResult));
21479 #endif
21480 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<TResult>(
21481 Expression.Invoke(
21482 Expression.Call(
21483 null,
21484 m,
21485 Expression.Constant(provider, typeof(IQbservableProvider)),
21486 function
21487 ),
21488 Expression.Constant(t1, typeof(TArg1)),
21489 Expression.Constant(t2, typeof(TArg2)),
21490 Expression.Constant(t3, typeof(TArg3)),
21491 Expression.Constant(t4, typeof(TArg4)),
21492 Expression.Constant(t5, typeof(TArg5)),
21493 Expression.Constant(t6, typeof(TArg6)),
21494 Expression.Constant(t7, typeof(TArg7)),
21495 Expression.Constant(t8, typeof(TArg8)),
21496 Expression.Constant(t9, typeof(TArg9)),
21497 Expression.Constant(t10, typeof(TArg10)),
21498 Expression.Constant(t11, typeof(TArg11)),
21499 Expression.Constant(t12, typeof(TArg12)),
21500 Expression.Constant(t13, typeof(TArg13)),
21501 Expression.Constant(t14, typeof(TArg14)),
21502 Expression.Constant(t15, typeof(TArg15))
21503 )
21504 );
21505 }
21506
21507 /// <summary>
21508 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21509 /// </summary>
21510 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21511 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21512 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21513 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21514 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21515 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21516 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21517 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21518 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21519 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21520 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21521 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21522 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21523 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21524 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21525 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
21526 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21527 /// <param name="function">Function to convert to an asynchronous function.</param>
21528 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21529 /// <returns>Asynchronous function.</returns>
21530 /// <exception cref="T:System.ArgumentNullException">
21531 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21532 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>> function, IScheduler scheduler)
21533 {
21534 if (provider == null)
21535 throw new ArgumentNullException("provider");
21536 if (function == null)
21537 throw new ArgumentNullException("function");
21538 if (scheduler == null)
21539 throw new ArgumentNullException("scheduler");
21540
21541 #if CRIPPLED_REFLECTION
21542 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TResult>>), default(IScheduler)));
21543 #else
21544 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TResult));
21545 #endif
21546 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) => provider.CreateQuery<TResult>(
21547 Expression.Invoke(
21548 Expression.Call(
21549 null,
21550 m,
21551 Expression.Constant(provider, typeof(IQbservableProvider)),
21552 function,
21553 Expression.Constant(scheduler, typeof(IScheduler))
21554 ),
21555 Expression.Constant(t1, typeof(TArg1)),
21556 Expression.Constant(t2, typeof(TArg2)),
21557 Expression.Constant(t3, typeof(TArg3)),
21558 Expression.Constant(t4, typeof(TArg4)),
21559 Expression.Constant(t5, typeof(TArg5)),
21560 Expression.Constant(t6, typeof(TArg6)),
21561 Expression.Constant(t7, typeof(TArg7)),
21562 Expression.Constant(t8, typeof(TArg8)),
21563 Expression.Constant(t9, typeof(TArg9)),
21564 Expression.Constant(t10, typeof(TArg10)),
21565 Expression.Constant(t11, typeof(TArg11)),
21566 Expression.Constant(t12, typeof(TArg12)),
21567 Expression.Constant(t13, typeof(TArg13)),
21568 Expression.Constant(t14, typeof(TArg14)),
21569 Expression.Constant(t15, typeof(TArg15))
21570 )
21571 );
21572 }
21573
21574 /// <summary>
21575 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function.
21576 /// </summary>
21577 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21578 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21579 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21580 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21581 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21582 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21583 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21584 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21585 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21586 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21587 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21588 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21589 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21590 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21591 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21592 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
21593 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
21594 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21595 /// <param name="function">Function to convert to an asynchronous function.</param>
21596 /// <returns>Asynchronous function.</returns>
21597 /// <exception cref="T:System.ArgumentNullException">
21598 /// <paramref name="function" /> is null.</exception>
21599 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>> function)
21600 {
21601 if (provider == null)
21602 throw new ArgumentNullException("provider");
21603 if (function == null)
21604 throw new ArgumentNullException("function");
21605
21606 #if CRIPPLED_REFLECTION
21607 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>>)));
21608 #else
21609 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16), typeof(TResult));
21610 #endif
21611 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<TResult>(
21612 Expression.Invoke(
21613 Expression.Call(
21614 null,
21615 m,
21616 Expression.Constant(provider, typeof(IQbservableProvider)),
21617 function
21618 ),
21619 Expression.Constant(t1, typeof(TArg1)),
21620 Expression.Constant(t2, typeof(TArg2)),
21621 Expression.Constant(t3, typeof(TArg3)),
21622 Expression.Constant(t4, typeof(TArg4)),
21623 Expression.Constant(t5, typeof(TArg5)),
21624 Expression.Constant(t6, typeof(TArg6)),
21625 Expression.Constant(t7, typeof(TArg7)),
21626 Expression.Constant(t8, typeof(TArg8)),
21627 Expression.Constant(t9, typeof(TArg9)),
21628 Expression.Constant(t10, typeof(TArg10)),
21629 Expression.Constant(t11, typeof(TArg11)),
21630 Expression.Constant(t12, typeof(TArg12)),
21631 Expression.Constant(t13, typeof(TArg13)),
21632 Expression.Constant(t14, typeof(TArg14)),
21633 Expression.Constant(t15, typeof(TArg15)),
21634 Expression.Constant(t16, typeof(TArg16))
21635 )
21636 );
21637 }
21638
21639 /// <summary>
21640 /// Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
21641 /// </summary>
21642 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21643 /// <typeparam name="TArg1">The type of the first argument passed to the function.</typeparam>
21644 /// <typeparam name="TArg2">The type of the second argument passed to the function.</typeparam>
21645 /// <typeparam name="TArg3">The type of the third argument passed to the function.</typeparam>
21646 /// <typeparam name="TArg4">The type of the fourth argument passed to the function.</typeparam>
21647 /// <typeparam name="TArg5">The type of the fifth argument passed to the function.</typeparam>
21648 /// <typeparam name="TArg6">The type of the sixth argument passed to the function.</typeparam>
21649 /// <typeparam name="TArg7">The type of the seventh argument passed to the function.</typeparam>
21650 /// <typeparam name="TArg8">The type of the eighth argument passed to the function.</typeparam>
21651 /// <typeparam name="TArg9">The type of the ninth argument passed to the function.</typeparam>
21652 /// <typeparam name="TArg10">The type of the tenth argument passed to the function.</typeparam>
21653 /// <typeparam name="TArg11">The type of the eleventh argument passed to the function.</typeparam>
21654 /// <typeparam name="TArg12">The type of the twelfth argument passed to the function.</typeparam>
21655 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the function.</typeparam>
21656 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the function.</typeparam>
21657 /// <typeparam name="TArg15">The type of the fifteenth argument passed to the function.</typeparam>
21658 /// <typeparam name="TArg16">The type of the sixteenth argument passed to the function.</typeparam>
21659 /// <typeparam name="TResult">The type of the result returned by the function.</typeparam>
21660 /// <param name="function">Function to convert to an asynchronous function.</param>
21661 /// <param name="scheduler">Scheduler to invoke the original function on.</param>
21662 /// <returns>Asynchronous function.</returns>
21663 /// <exception cref="T:System.ArgumentNullException">
21664 /// <paramref name="function" /> or <paramref name="scheduler" /> is null.</exception>
21665 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, IQbservable<TResult>> ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>> function, IScheduler scheduler)
21666 {
21667 if (provider == null)
21668 throw new ArgumentNullException("provider");
21669 if (function == null)
21670 throw new ArgumentNullException("function");
21671 if (scheduler == null)
21672 throw new ArgumentNullException("scheduler");
21673
21674 #if CRIPPLED_REFLECTION
21675 var m = InfoOf(() => Qbservable.ToAsync<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, TArg16, TResult>>), default(IScheduler)));
21676 #else
21677 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15), typeof(TArg16), typeof(TResult));
21678 #endif
21679 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16) => provider.CreateQuery<TResult>(
21680 Expression.Invoke(
21681 Expression.Call(
21682 null,
21683 m,
21684 Expression.Constant(provider, typeof(IQbservableProvider)),
21685 function,
21686 Expression.Constant(scheduler, typeof(IScheduler))
21687 ),
21688 Expression.Constant(t1, typeof(TArg1)),
21689 Expression.Constant(t2, typeof(TArg2)),
21690 Expression.Constant(t3, typeof(TArg3)),
21691 Expression.Constant(t4, typeof(TArg4)),
21692 Expression.Constant(t5, typeof(TArg5)),
21693 Expression.Constant(t6, typeof(TArg6)),
21694 Expression.Constant(t7, typeof(TArg7)),
21695 Expression.Constant(t8, typeof(TArg8)),
21696 Expression.Constant(t9, typeof(TArg9)),
21697 Expression.Constant(t10, typeof(TArg10)),
21698 Expression.Constant(t11, typeof(TArg11)),
21699 Expression.Constant(t12, typeof(TArg12)),
21700 Expression.Constant(t13, typeof(TArg13)),
21701 Expression.Constant(t14, typeof(TArg14)),
21702 Expression.Constant(t15, typeof(TArg15)),
21703 Expression.Constant(t16, typeof(TArg16))
21704 )
21705 );
21706 }
21707
21708 #endif
21709
21710 /// <summary>
21711 /// Converts a Begin/End invoke function pair into an asynchronous function.
21712 /// </summary>
21713 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21714 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21715 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21716 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21717 /// <exception cref="T:System.ArgumentNullException">
21718 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21719 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21720 #if PREFERASYNC
21721 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21722 #endif
21723 public static Func<IQbservable<Unit>> FromAsyncPattern(this IQbservableProvider provider, Expression<Func<AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21724 {
21725 if (provider == null)
21726 throw new ArgumentNullException("provider");
21727 if (begin == null)
21728 throw new ArgumentNullException("begin");
21729 if (end == null)
21730 throw new ArgumentNullException("end");
21731
21732 #if CRIPPLED_REFLECTION
21733 var m = InfoOf(() => Qbservable.FromAsyncPattern(default(IQbservableProvider), default(Expression<Func<AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21734 #else
21735 var m = (MethodInfo)MethodInfo.GetCurrentMethod();
21736 #endif
21737 return () => provider.CreateQuery<Unit>(
21738 Expression.Invoke(
21739 Expression.Call(
21740 null,
21741 m,
21742 Expression.Constant(provider, typeof(IQbservableProvider)),
21743 begin,
21744 end
21745 )
21746 )
21747 );
21748 }
21749
21750 /// <summary>
21751 /// Converts a Begin/End invoke function pair into an asynchronous function.
21752 /// </summary>
21753 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21754 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21755 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21756 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21757 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21758 /// <exception cref="T:System.ArgumentNullException">
21759 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21760 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21761 #if PREFERASYNC
21762 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21763 #endif
21764 public static Func<TArg1, IQbservable<Unit>> FromAsyncPattern<TArg1>(this IQbservableProvider provider, Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21765 {
21766 if (provider == null)
21767 throw new ArgumentNullException("provider");
21768 if (begin == null)
21769 throw new ArgumentNullException("begin");
21770 if (end == null)
21771 throw new ArgumentNullException("end");
21772
21773 #if CRIPPLED_REFLECTION
21774 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1>(default(IQbservableProvider), default(Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21775 #else
21776 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1));
21777 #endif
21778 return (t1) => provider.CreateQuery<Unit>(
21779 Expression.Invoke(
21780 Expression.Call(
21781 null,
21782 m,
21783 Expression.Constant(provider, typeof(IQbservableProvider)),
21784 begin,
21785 end
21786 ),
21787 Expression.Constant(t1, typeof(TArg1))
21788 )
21789 );
21790 }
21791
21792 /// <summary>
21793 /// Converts a Begin/End invoke function pair into an asynchronous function.
21794 /// </summary>
21795 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21796 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21797 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
21798 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21799 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21800 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21801 /// <exception cref="T:System.ArgumentNullException">
21802 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21803 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21804 #if PREFERASYNC
21805 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21806 #endif
21807 public static Func<TArg1, TArg2, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21808 {
21809 if (provider == null)
21810 throw new ArgumentNullException("provider");
21811 if (begin == null)
21812 throw new ArgumentNullException("begin");
21813 if (end == null)
21814 throw new ArgumentNullException("end");
21815
21816 #if CRIPPLED_REFLECTION
21817 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21818 #else
21819 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2));
21820 #endif
21821 return (t1, t2) => provider.CreateQuery<Unit>(
21822 Expression.Invoke(
21823 Expression.Call(
21824 null,
21825 m,
21826 Expression.Constant(provider, typeof(IQbservableProvider)),
21827 begin,
21828 end
21829 ),
21830 Expression.Constant(t1, typeof(TArg1)),
21831 Expression.Constant(t2, typeof(TArg2))
21832 )
21833 );
21834 }
21835
21836 #if !NO_LARGEARITY
21837 /// <summary>
21838 /// Converts a Begin/End invoke function pair into an asynchronous function.
21839 /// </summary>
21840 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21841 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21842 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
21843 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
21844 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21845 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21846 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21847 /// <exception cref="T:System.ArgumentNullException">
21848 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21849 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21850 #if PREFERASYNC
21851 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21852 #endif
21853 public static Func<TArg1, TArg2, TArg3, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21854 {
21855 if (provider == null)
21856 throw new ArgumentNullException("provider");
21857 if (begin == null)
21858 throw new ArgumentNullException("begin");
21859 if (end == null)
21860 throw new ArgumentNullException("end");
21861
21862 #if CRIPPLED_REFLECTION
21863 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21864 #else
21865 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3));
21866 #endif
21867 return (t1, t2, t3) => provider.CreateQuery<Unit>(
21868 Expression.Invoke(
21869 Expression.Call(
21870 null,
21871 m,
21872 Expression.Constant(provider, typeof(IQbservableProvider)),
21873 begin,
21874 end
21875 ),
21876 Expression.Constant(t1, typeof(TArg1)),
21877 Expression.Constant(t2, typeof(TArg2)),
21878 Expression.Constant(t3, typeof(TArg3))
21879 )
21880 );
21881 }
21882
21883 /// <summary>
21884 /// Converts a Begin/End invoke function pair into an asynchronous function.
21885 /// </summary>
21886 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21887 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21888 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
21889 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
21890 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
21891 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21892 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21893 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21894 /// <exception cref="T:System.ArgumentNullException">
21895 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21896 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21897 #if PREFERASYNC
21898 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21899 #endif
21900 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21901 {
21902 if (provider == null)
21903 throw new ArgumentNullException("provider");
21904 if (begin == null)
21905 throw new ArgumentNullException("begin");
21906 if (end == null)
21907 throw new ArgumentNullException("end");
21908
21909 #if CRIPPLED_REFLECTION
21910 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21911 #else
21912 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4));
21913 #endif
21914 return (t1, t2, t3, t4) => provider.CreateQuery<Unit>(
21915 Expression.Invoke(
21916 Expression.Call(
21917 null,
21918 m,
21919 Expression.Constant(provider, typeof(IQbservableProvider)),
21920 begin,
21921 end
21922 ),
21923 Expression.Constant(t1, typeof(TArg1)),
21924 Expression.Constant(t2, typeof(TArg2)),
21925 Expression.Constant(t3, typeof(TArg3)),
21926 Expression.Constant(t4, typeof(TArg4))
21927 )
21928 );
21929 }
21930
21931 /// <summary>
21932 /// Converts a Begin/End invoke function pair into an asynchronous function.
21933 /// </summary>
21934 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21935 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21936 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
21937 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
21938 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
21939 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
21940 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21941 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21942 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21943 /// <exception cref="T:System.ArgumentNullException">
21944 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21945 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21946 #if PREFERASYNC
21947 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21948 #endif
21949 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
21950 {
21951 if (provider == null)
21952 throw new ArgumentNullException("provider");
21953 if (begin == null)
21954 throw new ArgumentNullException("begin");
21955 if (end == null)
21956 throw new ArgumentNullException("end");
21957
21958 #if CRIPPLED_REFLECTION
21959 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
21960 #else
21961 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5));
21962 #endif
21963 return (t1, t2, t3, t4, t5) => provider.CreateQuery<Unit>(
21964 Expression.Invoke(
21965 Expression.Call(
21966 null,
21967 m,
21968 Expression.Constant(provider, typeof(IQbservableProvider)),
21969 begin,
21970 end
21971 ),
21972 Expression.Constant(t1, typeof(TArg1)),
21973 Expression.Constant(t2, typeof(TArg2)),
21974 Expression.Constant(t3, typeof(TArg3)),
21975 Expression.Constant(t4, typeof(TArg4)),
21976 Expression.Constant(t5, typeof(TArg5))
21977 )
21978 );
21979 }
21980
21981 /// <summary>
21982 /// Converts a Begin/End invoke function pair into an asynchronous function.
21983 /// </summary>
21984 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
21985 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
21986 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
21987 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
21988 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
21989 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
21990 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
21991 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
21992 /// <param name="end">The delegate that ends the asynchronous operation.</param>
21993 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
21994 /// <exception cref="T:System.ArgumentNullException">
21995 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
21996 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
21997 #if PREFERASYNC
21998 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
21999 #endif
22000 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22001 {
22002 if (provider == null)
22003 throw new ArgumentNullException("provider");
22004 if (begin == null)
22005 throw new ArgumentNullException("begin");
22006 if (end == null)
22007 throw new ArgumentNullException("end");
22008
22009 #if CRIPPLED_REFLECTION
22010 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22011 #else
22012 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6));
22013 #endif
22014 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<Unit>(
22015 Expression.Invoke(
22016 Expression.Call(
22017 null,
22018 m,
22019 Expression.Constant(provider, typeof(IQbservableProvider)),
22020 begin,
22021 end
22022 ),
22023 Expression.Constant(t1, typeof(TArg1)),
22024 Expression.Constant(t2, typeof(TArg2)),
22025 Expression.Constant(t3, typeof(TArg3)),
22026 Expression.Constant(t4, typeof(TArg4)),
22027 Expression.Constant(t5, typeof(TArg5)),
22028 Expression.Constant(t6, typeof(TArg6))
22029 )
22030 );
22031 }
22032
22033 /// <summary>
22034 /// Converts a Begin/End invoke function pair into an asynchronous function.
22035 /// </summary>
22036 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22037 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22038 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22039 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22040 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22041 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22042 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22043 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22044 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22045 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22046 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22047 /// <exception cref="T:System.ArgumentNullException">
22048 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22049 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22050 #if PREFERASYNC
22051 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22052 #endif
22053 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22054 {
22055 if (provider == null)
22056 throw new ArgumentNullException("provider");
22057 if (begin == null)
22058 throw new ArgumentNullException("begin");
22059 if (end == null)
22060 throw new ArgumentNullException("end");
22061
22062 #if CRIPPLED_REFLECTION
22063 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22064 #else
22065 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7));
22066 #endif
22067 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<Unit>(
22068 Expression.Invoke(
22069 Expression.Call(
22070 null,
22071 m,
22072 Expression.Constant(provider, typeof(IQbservableProvider)),
22073 begin,
22074 end
22075 ),
22076 Expression.Constant(t1, typeof(TArg1)),
22077 Expression.Constant(t2, typeof(TArg2)),
22078 Expression.Constant(t3, typeof(TArg3)),
22079 Expression.Constant(t4, typeof(TArg4)),
22080 Expression.Constant(t5, typeof(TArg5)),
22081 Expression.Constant(t6, typeof(TArg6)),
22082 Expression.Constant(t7, typeof(TArg7))
22083 )
22084 );
22085 }
22086
22087 /// <summary>
22088 /// Converts a Begin/End invoke function pair into an asynchronous function.
22089 /// </summary>
22090 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22091 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22092 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22093 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22094 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22095 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22096 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22097 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22098 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22099 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22100 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22101 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22102 /// <exception cref="T:System.ArgumentNullException">
22103 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22104 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22105 #if PREFERASYNC
22106 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22107 #endif
22108 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22109 {
22110 if (provider == null)
22111 throw new ArgumentNullException("provider");
22112 if (begin == null)
22113 throw new ArgumentNullException("begin");
22114 if (end == null)
22115 throw new ArgumentNullException("end");
22116
22117 #if CRIPPLED_REFLECTION
22118 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22119 #else
22120 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8));
22121 #endif
22122 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<Unit>(
22123 Expression.Invoke(
22124 Expression.Call(
22125 null,
22126 m,
22127 Expression.Constant(provider, typeof(IQbservableProvider)),
22128 begin,
22129 end
22130 ),
22131 Expression.Constant(t1, typeof(TArg1)),
22132 Expression.Constant(t2, typeof(TArg2)),
22133 Expression.Constant(t3, typeof(TArg3)),
22134 Expression.Constant(t4, typeof(TArg4)),
22135 Expression.Constant(t5, typeof(TArg5)),
22136 Expression.Constant(t6, typeof(TArg6)),
22137 Expression.Constant(t7, typeof(TArg7)),
22138 Expression.Constant(t8, typeof(TArg8))
22139 )
22140 );
22141 }
22142
22143 /// <summary>
22144 /// Converts a Begin/End invoke function pair into an asynchronous function.
22145 /// </summary>
22146 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22147 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22148 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22149 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22150 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22151 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22152 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22153 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22154 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22155 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22156 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22157 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22158 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22159 /// <exception cref="T:System.ArgumentNullException">
22160 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22161 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22162 #if PREFERASYNC
22163 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22164 #endif
22165 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22166 {
22167 if (provider == null)
22168 throw new ArgumentNullException("provider");
22169 if (begin == null)
22170 throw new ArgumentNullException("begin");
22171 if (end == null)
22172 throw new ArgumentNullException("end");
22173
22174 #if CRIPPLED_REFLECTION
22175 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22176 #else
22177 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9));
22178 #endif
22179 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<Unit>(
22180 Expression.Invoke(
22181 Expression.Call(
22182 null,
22183 m,
22184 Expression.Constant(provider, typeof(IQbservableProvider)),
22185 begin,
22186 end
22187 ),
22188 Expression.Constant(t1, typeof(TArg1)),
22189 Expression.Constant(t2, typeof(TArg2)),
22190 Expression.Constant(t3, typeof(TArg3)),
22191 Expression.Constant(t4, typeof(TArg4)),
22192 Expression.Constant(t5, typeof(TArg5)),
22193 Expression.Constant(t6, typeof(TArg6)),
22194 Expression.Constant(t7, typeof(TArg7)),
22195 Expression.Constant(t8, typeof(TArg8)),
22196 Expression.Constant(t9, typeof(TArg9))
22197 )
22198 );
22199 }
22200
22201 /// <summary>
22202 /// Converts a Begin/End invoke function pair into an asynchronous function.
22203 /// </summary>
22204 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22205 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22206 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22207 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22208 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22209 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22210 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22211 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22212 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22213 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22214 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
22215 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22216 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22217 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22218 /// <exception cref="T:System.ArgumentNullException">
22219 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22220 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22221 #if PREFERASYNC
22222 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22223 #endif
22224 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22225 {
22226 if (provider == null)
22227 throw new ArgumentNullException("provider");
22228 if (begin == null)
22229 throw new ArgumentNullException("begin");
22230 if (end == null)
22231 throw new ArgumentNullException("end");
22232
22233 #if CRIPPLED_REFLECTION
22234 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22235 #else
22236 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10));
22237 #endif
22238 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<Unit>(
22239 Expression.Invoke(
22240 Expression.Call(
22241 null,
22242 m,
22243 Expression.Constant(provider, typeof(IQbservableProvider)),
22244 begin,
22245 end
22246 ),
22247 Expression.Constant(t1, typeof(TArg1)),
22248 Expression.Constant(t2, typeof(TArg2)),
22249 Expression.Constant(t3, typeof(TArg3)),
22250 Expression.Constant(t4, typeof(TArg4)),
22251 Expression.Constant(t5, typeof(TArg5)),
22252 Expression.Constant(t6, typeof(TArg6)),
22253 Expression.Constant(t7, typeof(TArg7)),
22254 Expression.Constant(t8, typeof(TArg8)),
22255 Expression.Constant(t9, typeof(TArg9)),
22256 Expression.Constant(t10, typeof(TArg10))
22257 )
22258 );
22259 }
22260
22261 /// <summary>
22262 /// Converts a Begin/End invoke function pair into an asynchronous function.
22263 /// </summary>
22264 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22265 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22266 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22267 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22268 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22269 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22270 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22271 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22272 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22273 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22274 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
22275 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
22276 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22277 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22278 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22279 /// <exception cref="T:System.ArgumentNullException">
22280 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22281 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22282 #if PREFERASYNC
22283 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22284 #endif
22285 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22286 {
22287 if (provider == null)
22288 throw new ArgumentNullException("provider");
22289 if (begin == null)
22290 throw new ArgumentNullException("begin");
22291 if (end == null)
22292 throw new ArgumentNullException("end");
22293
22294 #if CRIPPLED_REFLECTION
22295 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22296 #else
22297 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11));
22298 #endif
22299 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<Unit>(
22300 Expression.Invoke(
22301 Expression.Call(
22302 null,
22303 m,
22304 Expression.Constant(provider, typeof(IQbservableProvider)),
22305 begin,
22306 end
22307 ),
22308 Expression.Constant(t1, typeof(TArg1)),
22309 Expression.Constant(t2, typeof(TArg2)),
22310 Expression.Constant(t3, typeof(TArg3)),
22311 Expression.Constant(t4, typeof(TArg4)),
22312 Expression.Constant(t5, typeof(TArg5)),
22313 Expression.Constant(t6, typeof(TArg6)),
22314 Expression.Constant(t7, typeof(TArg7)),
22315 Expression.Constant(t8, typeof(TArg8)),
22316 Expression.Constant(t9, typeof(TArg9)),
22317 Expression.Constant(t10, typeof(TArg10)),
22318 Expression.Constant(t11, typeof(TArg11))
22319 )
22320 );
22321 }
22322
22323 /// <summary>
22324 /// Converts a Begin/End invoke function pair into an asynchronous function.
22325 /// </summary>
22326 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22327 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22328 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22329 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22330 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22331 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22332 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22333 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22334 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22335 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22336 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
22337 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
22338 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
22339 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22340 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22341 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22342 /// <exception cref="T:System.ArgumentNullException">
22343 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22344 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22345 #if PREFERASYNC
22346 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22347 #endif
22348 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22349 {
22350 if (provider == null)
22351 throw new ArgumentNullException("provider");
22352 if (begin == null)
22353 throw new ArgumentNullException("begin");
22354 if (end == null)
22355 throw new ArgumentNullException("end");
22356
22357 #if CRIPPLED_REFLECTION
22358 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22359 #else
22360 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12));
22361 #endif
22362 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<Unit>(
22363 Expression.Invoke(
22364 Expression.Call(
22365 null,
22366 m,
22367 Expression.Constant(provider, typeof(IQbservableProvider)),
22368 begin,
22369 end
22370 ),
22371 Expression.Constant(t1, typeof(TArg1)),
22372 Expression.Constant(t2, typeof(TArg2)),
22373 Expression.Constant(t3, typeof(TArg3)),
22374 Expression.Constant(t4, typeof(TArg4)),
22375 Expression.Constant(t5, typeof(TArg5)),
22376 Expression.Constant(t6, typeof(TArg6)),
22377 Expression.Constant(t7, typeof(TArg7)),
22378 Expression.Constant(t8, typeof(TArg8)),
22379 Expression.Constant(t9, typeof(TArg9)),
22380 Expression.Constant(t10, typeof(TArg10)),
22381 Expression.Constant(t11, typeof(TArg11)),
22382 Expression.Constant(t12, typeof(TArg12))
22383 )
22384 );
22385 }
22386
22387 /// <summary>
22388 /// Converts a Begin/End invoke function pair into an asynchronous function.
22389 /// </summary>
22390 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22391 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22392 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22393 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22394 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22395 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22396 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22397 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22398 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22399 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22400 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
22401 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
22402 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
22403 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
22404 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22405 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22406 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22407 /// <exception cref="T:System.ArgumentNullException">
22408 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22409 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22410 #if PREFERASYNC
22411 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22412 #endif
22413 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22414 {
22415 if (provider == null)
22416 throw new ArgumentNullException("provider");
22417 if (begin == null)
22418 throw new ArgumentNullException("begin");
22419 if (end == null)
22420 throw new ArgumentNullException("end");
22421
22422 #if CRIPPLED_REFLECTION
22423 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22424 #else
22425 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13));
22426 #endif
22427 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<Unit>(
22428 Expression.Invoke(
22429 Expression.Call(
22430 null,
22431 m,
22432 Expression.Constant(provider, typeof(IQbservableProvider)),
22433 begin,
22434 end
22435 ),
22436 Expression.Constant(t1, typeof(TArg1)),
22437 Expression.Constant(t2, typeof(TArg2)),
22438 Expression.Constant(t3, typeof(TArg3)),
22439 Expression.Constant(t4, typeof(TArg4)),
22440 Expression.Constant(t5, typeof(TArg5)),
22441 Expression.Constant(t6, typeof(TArg6)),
22442 Expression.Constant(t7, typeof(TArg7)),
22443 Expression.Constant(t8, typeof(TArg8)),
22444 Expression.Constant(t9, typeof(TArg9)),
22445 Expression.Constant(t10, typeof(TArg10)),
22446 Expression.Constant(t11, typeof(TArg11)),
22447 Expression.Constant(t12, typeof(TArg12)),
22448 Expression.Constant(t13, typeof(TArg13))
22449 )
22450 );
22451 }
22452
22453 /// <summary>
22454 /// Converts a Begin/End invoke function pair into an asynchronous function.
22455 /// </summary>
22456 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22457 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22458 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22459 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22460 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22461 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22462 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22463 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22464 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22465 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22466 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
22467 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
22468 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
22469 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
22470 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
22471 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22472 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22473 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result (represented as a Unit value) as an observable sequence.</returns>
22474 /// <exception cref="T:System.ArgumentNullException">
22475 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22476 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22477 #if PREFERASYNC
22478 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22479 #endif
22480 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<Unit>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>> begin, Expression<Action<IAsyncResult>>end)
22481 {
22482 if (provider == null)
22483 throw new ArgumentNullException("provider");
22484 if (begin == null)
22485 throw new ArgumentNullException("begin");
22486 if (end == null)
22487 throw new ArgumentNullException("end");
22488
22489 #if CRIPPLED_REFLECTION
22490 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>>), default(Expression<Action<IAsyncResult>>)));
22491 #else
22492 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14));
22493 #endif
22494 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<Unit>(
22495 Expression.Invoke(
22496 Expression.Call(
22497 null,
22498 m,
22499 Expression.Constant(provider, typeof(IQbservableProvider)),
22500 begin,
22501 end
22502 ),
22503 Expression.Constant(t1, typeof(TArg1)),
22504 Expression.Constant(t2, typeof(TArg2)),
22505 Expression.Constant(t3, typeof(TArg3)),
22506 Expression.Constant(t4, typeof(TArg4)),
22507 Expression.Constant(t5, typeof(TArg5)),
22508 Expression.Constant(t6, typeof(TArg6)),
22509 Expression.Constant(t7, typeof(TArg7)),
22510 Expression.Constant(t8, typeof(TArg8)),
22511 Expression.Constant(t9, typeof(TArg9)),
22512 Expression.Constant(t10, typeof(TArg10)),
22513 Expression.Constant(t11, typeof(TArg11)),
22514 Expression.Constant(t12, typeof(TArg12)),
22515 Expression.Constant(t13, typeof(TArg13)),
22516 Expression.Constant(t14, typeof(TArg14))
22517 )
22518 );
22519 }
22520
22521 #endif
22522 /// <summary>
22523 /// Converts a Begin/End invoke function pair into an asynchronous function.
22524 /// </summary>
22525 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22526 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22527 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22528 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22529 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22530 /// <exception cref="T:System.ArgumentNullException">
22531 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22532 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22533 #if PREFERASYNC
22534 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22535 #endif
22536 public static Func<IQbservable<TResult>> FromAsyncPattern<TResult>(this IQbservableProvider provider, Expression<Func<AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22537 {
22538 if (provider == null)
22539 throw new ArgumentNullException("provider");
22540 if (begin == null)
22541 throw new ArgumentNullException("begin");
22542 if (end == null)
22543 throw new ArgumentNullException("end");
22544
22545 #if CRIPPLED_REFLECTION
22546 var m = InfoOf(() => Qbservable.FromAsyncPattern<TResult>(default(IQbservableProvider), default(Expression<Func<AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22547 #else
22548 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult));
22549 #endif
22550 return () => provider.CreateQuery<TResult>(
22551 Expression.Invoke(
22552 Expression.Call(
22553 null,
22554 m,
22555 Expression.Constant(provider, typeof(IQbservableProvider)),
22556 begin,
22557 end
22558 )
22559 )
22560 );
22561 }
22562
22563 /// <summary>
22564 /// Converts a Begin/End invoke function pair into an asynchronous function.
22565 /// </summary>
22566 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22567 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22568 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22569 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22570 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22571 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22572 /// <exception cref="T:System.ArgumentNullException">
22573 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22574 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22575 #if PREFERASYNC
22576 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22577 #endif
22578 public static Func<TArg1, IQbservable<TResult>> FromAsyncPattern<TArg1, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22579 {
22580 if (provider == null)
22581 throw new ArgumentNullException("provider");
22582 if (begin == null)
22583 throw new ArgumentNullException("begin");
22584 if (end == null)
22585 throw new ArgumentNullException("end");
22586
22587 #if CRIPPLED_REFLECTION
22588 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22589 #else
22590 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TResult));
22591 #endif
22592 return (t1) => provider.CreateQuery<TResult>(
22593 Expression.Invoke(
22594 Expression.Call(
22595 null,
22596 m,
22597 Expression.Constant(provider, typeof(IQbservableProvider)),
22598 begin,
22599 end
22600 ),
22601 Expression.Constant(t1, typeof(TArg1))
22602 )
22603 );
22604 }
22605
22606 /// <summary>
22607 /// Converts a Begin/End invoke function pair into an asynchronous function.
22608 /// </summary>
22609 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22610 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22611 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22612 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22613 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22614 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22615 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22616 /// <exception cref="T:System.ArgumentNullException">
22617 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22618 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22619 #if PREFERASYNC
22620 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22621 #endif
22622 public static Func<TArg1, TArg2, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22623 {
22624 if (provider == null)
22625 throw new ArgumentNullException("provider");
22626 if (begin == null)
22627 throw new ArgumentNullException("begin");
22628 if (end == null)
22629 throw new ArgumentNullException("end");
22630
22631 #if CRIPPLED_REFLECTION
22632 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22633 #else
22634 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TResult));
22635 #endif
22636 return (t1, t2) => provider.CreateQuery<TResult>(
22637 Expression.Invoke(
22638 Expression.Call(
22639 null,
22640 m,
22641 Expression.Constant(provider, typeof(IQbservableProvider)),
22642 begin,
22643 end
22644 ),
22645 Expression.Constant(t1, typeof(TArg1)),
22646 Expression.Constant(t2, typeof(TArg2))
22647 )
22648 );
22649 }
22650
22651 #if !NO_LARGEARITY
22652 /// <summary>
22653 /// Converts a Begin/End invoke function pair into an asynchronous function.
22654 /// </summary>
22655 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22656 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22657 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22658 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22659 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22660 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22661 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22662 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22663 /// <exception cref="T:System.ArgumentNullException">
22664 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22665 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22666 #if PREFERASYNC
22667 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22668 #endif
22669 public static Func<TArg1, TArg2, TArg3, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22670 {
22671 if (provider == null)
22672 throw new ArgumentNullException("provider");
22673 if (begin == null)
22674 throw new ArgumentNullException("begin");
22675 if (end == null)
22676 throw new ArgumentNullException("end");
22677
22678 #if CRIPPLED_REFLECTION
22679 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22680 #else
22681 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TResult));
22682 #endif
22683 return (t1, t2, t3) => provider.CreateQuery<TResult>(
22684 Expression.Invoke(
22685 Expression.Call(
22686 null,
22687 m,
22688 Expression.Constant(provider, typeof(IQbservableProvider)),
22689 begin,
22690 end
22691 ),
22692 Expression.Constant(t1, typeof(TArg1)),
22693 Expression.Constant(t2, typeof(TArg2)),
22694 Expression.Constant(t3, typeof(TArg3))
22695 )
22696 );
22697 }
22698
22699 /// <summary>
22700 /// Converts a Begin/End invoke function pair into an asynchronous function.
22701 /// </summary>
22702 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22703 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22704 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22705 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22706 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22707 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22708 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22709 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22710 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22711 /// <exception cref="T:System.ArgumentNullException">
22712 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22713 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22714 #if PREFERASYNC
22715 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22716 #endif
22717 public static Func<TArg1, TArg2, TArg3, TArg4, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22718 {
22719 if (provider == null)
22720 throw new ArgumentNullException("provider");
22721 if (begin == null)
22722 throw new ArgumentNullException("begin");
22723 if (end == null)
22724 throw new ArgumentNullException("end");
22725
22726 #if CRIPPLED_REFLECTION
22727 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22728 #else
22729 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TResult));
22730 #endif
22731 return (t1, t2, t3, t4) => provider.CreateQuery<TResult>(
22732 Expression.Invoke(
22733 Expression.Call(
22734 null,
22735 m,
22736 Expression.Constant(provider, typeof(IQbservableProvider)),
22737 begin,
22738 end
22739 ),
22740 Expression.Constant(t1, typeof(TArg1)),
22741 Expression.Constant(t2, typeof(TArg2)),
22742 Expression.Constant(t3, typeof(TArg3)),
22743 Expression.Constant(t4, typeof(TArg4))
22744 )
22745 );
22746 }
22747
22748 /// <summary>
22749 /// Converts a Begin/End invoke function pair into an asynchronous function.
22750 /// </summary>
22751 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22752 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22753 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22754 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22755 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22756 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22757 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22758 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22759 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22760 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22761 /// <exception cref="T:System.ArgumentNullException">
22762 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22763 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22764 #if PREFERASYNC
22765 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22766 #endif
22767 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22768 {
22769 if (provider == null)
22770 throw new ArgumentNullException("provider");
22771 if (begin == null)
22772 throw new ArgumentNullException("begin");
22773 if (end == null)
22774 throw new ArgumentNullException("end");
22775
22776 #if CRIPPLED_REFLECTION
22777 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22778 #else
22779 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TResult));
22780 #endif
22781 return (t1, t2, t3, t4, t5) => provider.CreateQuery<TResult>(
22782 Expression.Invoke(
22783 Expression.Call(
22784 null,
22785 m,
22786 Expression.Constant(provider, typeof(IQbservableProvider)),
22787 begin,
22788 end
22789 ),
22790 Expression.Constant(t1, typeof(TArg1)),
22791 Expression.Constant(t2, typeof(TArg2)),
22792 Expression.Constant(t3, typeof(TArg3)),
22793 Expression.Constant(t4, typeof(TArg4)),
22794 Expression.Constant(t5, typeof(TArg5))
22795 )
22796 );
22797 }
22798
22799 /// <summary>
22800 /// Converts a Begin/End invoke function pair into an asynchronous function.
22801 /// </summary>
22802 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22803 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22804 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22805 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22806 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22807 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22808 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22809 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22810 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22811 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22812 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22813 /// <exception cref="T:System.ArgumentNullException">
22814 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22815 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22816 #if PREFERASYNC
22817 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22818 #endif
22819 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22820 {
22821 if (provider == null)
22822 throw new ArgumentNullException("provider");
22823 if (begin == null)
22824 throw new ArgumentNullException("begin");
22825 if (end == null)
22826 throw new ArgumentNullException("end");
22827
22828 #if CRIPPLED_REFLECTION
22829 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22830 #else
22831 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TResult));
22832 #endif
22833 return (t1, t2, t3, t4, t5, t6) => provider.CreateQuery<TResult>(
22834 Expression.Invoke(
22835 Expression.Call(
22836 null,
22837 m,
22838 Expression.Constant(provider, typeof(IQbservableProvider)),
22839 begin,
22840 end
22841 ),
22842 Expression.Constant(t1, typeof(TArg1)),
22843 Expression.Constant(t2, typeof(TArg2)),
22844 Expression.Constant(t3, typeof(TArg3)),
22845 Expression.Constant(t4, typeof(TArg4)),
22846 Expression.Constant(t5, typeof(TArg5)),
22847 Expression.Constant(t6, typeof(TArg6))
22848 )
22849 );
22850 }
22851
22852 /// <summary>
22853 /// Converts a Begin/End invoke function pair into an asynchronous function.
22854 /// </summary>
22855 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22856 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22857 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22858 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22859 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22860 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22861 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22862 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22863 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22864 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22865 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22866 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22867 /// <exception cref="T:System.ArgumentNullException">
22868 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22869 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22870 #if PREFERASYNC
22871 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22872 #endif
22873 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22874 {
22875 if (provider == null)
22876 throw new ArgumentNullException("provider");
22877 if (begin == null)
22878 throw new ArgumentNullException("begin");
22879 if (end == null)
22880 throw new ArgumentNullException("end");
22881
22882 #if CRIPPLED_REFLECTION
22883 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22884 #else
22885 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TResult));
22886 #endif
22887 return (t1, t2, t3, t4, t5, t6, t7) => provider.CreateQuery<TResult>(
22888 Expression.Invoke(
22889 Expression.Call(
22890 null,
22891 m,
22892 Expression.Constant(provider, typeof(IQbservableProvider)),
22893 begin,
22894 end
22895 ),
22896 Expression.Constant(t1, typeof(TArg1)),
22897 Expression.Constant(t2, typeof(TArg2)),
22898 Expression.Constant(t3, typeof(TArg3)),
22899 Expression.Constant(t4, typeof(TArg4)),
22900 Expression.Constant(t5, typeof(TArg5)),
22901 Expression.Constant(t6, typeof(TArg6)),
22902 Expression.Constant(t7, typeof(TArg7))
22903 )
22904 );
22905 }
22906
22907 /// <summary>
22908 /// Converts a Begin/End invoke function pair into an asynchronous function.
22909 /// </summary>
22910 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22911 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22912 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22913 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22914 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22915 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22916 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22917 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22918 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22919 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22920 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22921 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22922 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22923 /// <exception cref="T:System.ArgumentNullException">
22924 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22925 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22926 #if PREFERASYNC
22927 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22928 #endif
22929 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22930 {
22931 if (provider == null)
22932 throw new ArgumentNullException("provider");
22933 if (begin == null)
22934 throw new ArgumentNullException("begin");
22935 if (end == null)
22936 throw new ArgumentNullException("end");
22937
22938 #if CRIPPLED_REFLECTION
22939 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22940 #else
22941 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TResult));
22942 #endif
22943 return (t1, t2, t3, t4, t5, t6, t7, t8) => provider.CreateQuery<TResult>(
22944 Expression.Invoke(
22945 Expression.Call(
22946 null,
22947 m,
22948 Expression.Constant(provider, typeof(IQbservableProvider)),
22949 begin,
22950 end
22951 ),
22952 Expression.Constant(t1, typeof(TArg1)),
22953 Expression.Constant(t2, typeof(TArg2)),
22954 Expression.Constant(t3, typeof(TArg3)),
22955 Expression.Constant(t4, typeof(TArg4)),
22956 Expression.Constant(t5, typeof(TArg5)),
22957 Expression.Constant(t6, typeof(TArg6)),
22958 Expression.Constant(t7, typeof(TArg7)),
22959 Expression.Constant(t8, typeof(TArg8))
22960 )
22961 );
22962 }
22963
22964 /// <summary>
22965 /// Converts a Begin/End invoke function pair into an asynchronous function.
22966 /// </summary>
22967 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
22968 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
22969 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
22970 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
22971 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
22972 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
22973 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
22974 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
22975 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
22976 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
22977 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
22978 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
22979 /// <param name="end">The delegate that ends the asynchronous operation.</param>
22980 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
22981 /// <exception cref="T:System.ArgumentNullException">
22982 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
22983 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
22984 #if PREFERASYNC
22985 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
22986 #endif
22987 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
22988 {
22989 if (provider == null)
22990 throw new ArgumentNullException("provider");
22991 if (begin == null)
22992 throw new ArgumentNullException("begin");
22993 if (end == null)
22994 throw new ArgumentNullException("end");
22995
22996 #if CRIPPLED_REFLECTION
22997 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
22998 #else
22999 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TResult));
23000 #endif
23001 return (t1, t2, t3, t4, t5, t6, t7, t8, t9) => provider.CreateQuery<TResult>(
23002 Expression.Invoke(
23003 Expression.Call(
23004 null,
23005 m,
23006 Expression.Constant(provider, typeof(IQbservableProvider)),
23007 begin,
23008 end
23009 ),
23010 Expression.Constant(t1, typeof(TArg1)),
23011 Expression.Constant(t2, typeof(TArg2)),
23012 Expression.Constant(t3, typeof(TArg3)),
23013 Expression.Constant(t4, typeof(TArg4)),
23014 Expression.Constant(t5, typeof(TArg5)),
23015 Expression.Constant(t6, typeof(TArg6)),
23016 Expression.Constant(t7, typeof(TArg7)),
23017 Expression.Constant(t8, typeof(TArg8)),
23018 Expression.Constant(t9, typeof(TArg9))
23019 )
23020 );
23021 }
23022
23023 /// <summary>
23024 /// Converts a Begin/End invoke function pair into an asynchronous function.
23025 /// </summary>
23026 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
23027 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
23028 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
23029 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
23030 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
23031 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
23032 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
23033 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
23034 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
23035 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
23036 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
23037 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
23038 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23039 /// <param name="end">The delegate that ends the asynchronous operation.</param>
23040 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
23041 /// <exception cref="T:System.ArgumentNullException">
23042 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
23043 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
23044 #if PREFERASYNC
23045 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
23046 #endif
23047 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
23048 {
23049 if (provider == null)
23050 throw new ArgumentNullException("provider");
23051 if (begin == null)
23052 throw new ArgumentNullException("begin");
23053 if (end == null)
23054 throw new ArgumentNullException("end");
23055
23056 #if CRIPPLED_REFLECTION
23057 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
23058 #else
23059 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TResult));
23060 #endif
23061 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => provider.CreateQuery<TResult>(
23062 Expression.Invoke(
23063 Expression.Call(
23064 null,
23065 m,
23066 Expression.Constant(provider, typeof(IQbservableProvider)),
23067 begin,
23068 end
23069 ),
23070 Expression.Constant(t1, typeof(TArg1)),
23071 Expression.Constant(t2, typeof(TArg2)),
23072 Expression.Constant(t3, typeof(TArg3)),
23073 Expression.Constant(t4, typeof(TArg4)),
23074 Expression.Constant(t5, typeof(TArg5)),
23075 Expression.Constant(t6, typeof(TArg6)),
23076 Expression.Constant(t7, typeof(TArg7)),
23077 Expression.Constant(t8, typeof(TArg8)),
23078 Expression.Constant(t9, typeof(TArg9)),
23079 Expression.Constant(t10, typeof(TArg10))
23080 )
23081 );
23082 }
23083
23084 /// <summary>
23085 /// Converts a Begin/End invoke function pair into an asynchronous function.
23086 /// </summary>
23087 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
23088 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
23089 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
23090 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
23091 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
23092 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
23093 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
23094 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
23095 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
23096 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
23097 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
23098 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
23099 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
23100 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23101 /// <param name="end">The delegate that ends the asynchronous operation.</param>
23102 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
23103 /// <exception cref="T:System.ArgumentNullException">
23104 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
23105 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
23106 #if PREFERASYNC
23107 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
23108 #endif
23109 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
23110 {
23111 if (provider == null)
23112 throw new ArgumentNullException("provider");
23113 if (begin == null)
23114 throw new ArgumentNullException("begin");
23115 if (end == null)
23116 throw new ArgumentNullException("end");
23117
23118 #if CRIPPLED_REFLECTION
23119 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
23120 #else
23121 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TResult));
23122 #endif
23123 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11) => provider.CreateQuery<TResult>(
23124 Expression.Invoke(
23125 Expression.Call(
23126 null,
23127 m,
23128 Expression.Constant(provider, typeof(IQbservableProvider)),
23129 begin,
23130 end
23131 ),
23132 Expression.Constant(t1, typeof(TArg1)),
23133 Expression.Constant(t2, typeof(TArg2)),
23134 Expression.Constant(t3, typeof(TArg3)),
23135 Expression.Constant(t4, typeof(TArg4)),
23136 Expression.Constant(t5, typeof(TArg5)),
23137 Expression.Constant(t6, typeof(TArg6)),
23138 Expression.Constant(t7, typeof(TArg7)),
23139 Expression.Constant(t8, typeof(TArg8)),
23140 Expression.Constant(t9, typeof(TArg9)),
23141 Expression.Constant(t10, typeof(TArg10)),
23142 Expression.Constant(t11, typeof(TArg11))
23143 )
23144 );
23145 }
23146
23147 /// <summary>
23148 /// Converts a Begin/End invoke function pair into an asynchronous function.
23149 /// </summary>
23150 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
23151 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
23152 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
23153 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
23154 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
23155 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
23156 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
23157 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
23158 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
23159 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
23160 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
23161 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
23162 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
23163 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
23164 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23165 /// <param name="end">The delegate that ends the asynchronous operation.</param>
23166 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
23167 /// <exception cref="T:System.ArgumentNullException">
23168 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
23169 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
23170 #if PREFERASYNC
23171 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
23172 #endif
23173 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
23174 {
23175 if (provider == null)
23176 throw new ArgumentNullException("provider");
23177 if (begin == null)
23178 throw new ArgumentNullException("begin");
23179 if (end == null)
23180 throw new ArgumentNullException("end");
23181
23182 #if CRIPPLED_REFLECTION
23183 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
23184 #else
23185 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TResult));
23186 #endif
23187 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) => provider.CreateQuery<TResult>(
23188 Expression.Invoke(
23189 Expression.Call(
23190 null,
23191 m,
23192 Expression.Constant(provider, typeof(IQbservableProvider)),
23193 begin,
23194 end
23195 ),
23196 Expression.Constant(t1, typeof(TArg1)),
23197 Expression.Constant(t2, typeof(TArg2)),
23198 Expression.Constant(t3, typeof(TArg3)),
23199 Expression.Constant(t4, typeof(TArg4)),
23200 Expression.Constant(t5, typeof(TArg5)),
23201 Expression.Constant(t6, typeof(TArg6)),
23202 Expression.Constant(t7, typeof(TArg7)),
23203 Expression.Constant(t8, typeof(TArg8)),
23204 Expression.Constant(t9, typeof(TArg9)),
23205 Expression.Constant(t10, typeof(TArg10)),
23206 Expression.Constant(t11, typeof(TArg11)),
23207 Expression.Constant(t12, typeof(TArg12))
23208 )
23209 );
23210 }
23211
23212 /// <summary>
23213 /// Converts a Begin/End invoke function pair into an asynchronous function.
23214 /// </summary>
23215 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
23216 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
23217 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
23218 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
23219 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
23220 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
23221 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
23222 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
23223 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
23224 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
23225 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
23226 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
23227 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
23228 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
23229 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
23230 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23231 /// <param name="end">The delegate that ends the asynchronous operation.</param>
23232 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
23233 /// <exception cref="T:System.ArgumentNullException">
23234 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
23235 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
23236 #if PREFERASYNC
23237 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
23238 #endif
23239 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
23240 {
23241 if (provider == null)
23242 throw new ArgumentNullException("provider");
23243 if (begin == null)
23244 throw new ArgumentNullException("begin");
23245 if (end == null)
23246 throw new ArgumentNullException("end");
23247
23248 #if CRIPPLED_REFLECTION
23249 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
23250 #else
23251 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TResult));
23252 #endif
23253 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13) => provider.CreateQuery<TResult>(
23254 Expression.Invoke(
23255 Expression.Call(
23256 null,
23257 m,
23258 Expression.Constant(provider, typeof(IQbservableProvider)),
23259 begin,
23260 end
23261 ),
23262 Expression.Constant(t1, typeof(TArg1)),
23263 Expression.Constant(t2, typeof(TArg2)),
23264 Expression.Constant(t3, typeof(TArg3)),
23265 Expression.Constant(t4, typeof(TArg4)),
23266 Expression.Constant(t5, typeof(TArg5)),
23267 Expression.Constant(t6, typeof(TArg6)),
23268 Expression.Constant(t7, typeof(TArg7)),
23269 Expression.Constant(t8, typeof(TArg8)),
23270 Expression.Constant(t9, typeof(TArg9)),
23271 Expression.Constant(t10, typeof(TArg10)),
23272 Expression.Constant(t11, typeof(TArg11)),
23273 Expression.Constant(t12, typeof(TArg12)),
23274 Expression.Constant(t13, typeof(TArg13))
23275 )
23276 );
23277 }
23278
23279 /// <summary>
23280 /// Converts a Begin/End invoke function pair into an asynchronous function.
23281 /// </summary>
23282 /// <param name="provider">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>
23283 /// <typeparam name="TArg1">The type of the first argument passed to the begin delegate.</typeparam>
23284 /// <typeparam name="TArg2">The type of the second argument passed to the begin delegate.</typeparam>
23285 /// <typeparam name="TArg3">The type of the third argument passed to the begin delegate.</typeparam>
23286 /// <typeparam name="TArg4">The type of the fourth argument passed to the begin delegate.</typeparam>
23287 /// <typeparam name="TArg5">The type of the fifth argument passed to the begin delegate.</typeparam>
23288 /// <typeparam name="TArg6">The type of the sixth argument passed to the begin delegate.</typeparam>
23289 /// <typeparam name="TArg7">The type of the seventh argument passed to the begin delegate.</typeparam>
23290 /// <typeparam name="TArg8">The type of the eighth argument passed to the begin delegate.</typeparam>
23291 /// <typeparam name="TArg9">The type of the ninth argument passed to the begin delegate.</typeparam>
23292 /// <typeparam name="TArg10">The type of the tenth argument passed to the begin delegate.</typeparam>
23293 /// <typeparam name="TArg11">The type of the eleventh argument passed to the begin delegate.</typeparam>
23294 /// <typeparam name="TArg12">The type of the twelfth argument passed to the begin delegate.</typeparam>
23295 /// <typeparam name="TArg13">The type of the thirteenth argument passed to the begin delegate.</typeparam>
23296 /// <typeparam name="TArg14">The type of the fourteenth argument passed to the begin delegate.</typeparam>
23297 /// <typeparam name="TResult">The type of the result returned by the end delegate.</typeparam>
23298 /// <param name="begin">The delegate that begins the asynchronous operation.</param>
23299 /// <param name="end">The delegate that ends the asynchronous operation.</param>
23300 /// <returns>Function that can be used to start the asynchronous operation and retrieve the result as an observable sequence.</returns>
23301 /// <exception cref="T:System.ArgumentNullException">
23302 /// <paramref name="begin" /> or <paramref name="end" /> is null.</exception>
23303 /// <remarks>Each invocation of the resulting function will cause the asynchronous operation to be started. Subscription to the resulting sequence has no observable side-effect, and each subscription will produce the asynchronous operation's result.</remarks>
23304 #if PREFERASYNC
23305 [Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]
23306 #endif
23307 public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, IQbservable<TResult>> FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(this IQbservableProvider provider, Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>> begin, Expression<Func<IAsyncResult, TResult>>end)
23308 {
23309 if (provider == null)
23310 throw new ArgumentNullException("provider");
23311 if (begin == null)
23312 throw new ArgumentNullException("begin");
23313 if (end == null)
23314 throw new ArgumentNullException("end");
23315
23316 #if CRIPPLED_REFLECTION
23317 var m = InfoOf(() => Qbservable.FromAsyncPattern<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TResult>(default(IQbservableProvider), default(Expression<Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, AsyncCallback, object, IAsyncResult>>), default(Expression<Func<IAsyncResult, TResult>>)));
23318 #else
23319 var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TResult));
23320 #endif
23321 return (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) => provider.CreateQuery<TResult>(
23322 Expression.Invoke(
23323 Expression.Call(
23324 null,
23325 m,
23326 Expression.Constant(provider, typeof(IQbservableProvider)),
23327 begin,
23328 end
23329 ),
23330 Expression.Constant(t1, typeof(TArg1)),
23331 Expression.Constant(t2, typeof(TArg2)),
23332 Expression.Constant(t3, typeof(TArg3)),
23333 Expression.Constant(t4, typeof(TArg4)),
23334 Expression.Constant(t5, typeof(TArg5)),
23335 Expression.Constant(t6, typeof(TArg6)),
23336 Expression.Constant(t7, typeof(TArg7)),
23337 Expression.Constant(t8, typeof(TArg8)),
23338 Expression.Constant(t9, typeof(TArg9)),
23339 Expression.Constant(t10, typeof(TArg10)),
23340 Expression.Constant(t11, typeof(TArg11)),
23341 Expression.Constant(t12, typeof(TArg12)),
23342 Expression.Constant(t13, typeof(TArg13)),
23343 Expression.Constant(t14, typeof(TArg14))
23344 )
23345 );
23346 }
23347
23348 #endif
23349 }
23350 }
23351
23352 #endif
23353
23354 #pragma warning restore 1591
23355