1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Reactive.Concurrency;
using System.Reactive.Subjects;
namespace System.Reactive.Linq
{
public static partial class Observable
{
#region + Multicast +
/// <summary>
/// Multicasts the source sequence notifications through the specified subject to the resulting connectable observable. Upon connection of the
/// connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with
/// the connectable observable. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be pushed into the specified subject.</param>
/// <param name="subject">Subject to push source elements into.</param>
/// <returns>A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="subject"/> is null.</exception>
public static IConnectableObservable<TResult> Multicast<TSource, TResult>(this IObservable<TSource> source, ISubject<TSource, TResult> subject)
{
if (source == null)
throw new ArgumentNullException("source");
if (subject == null)
throw new ArgumentNullException("subject");
return s_impl.Multicast<TSource, TResult>(source, subject);
}
/// <summary>
/// Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
/// subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
/// invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TIntermediate">The type of the elements produced by the intermediate subject.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence which will be multicasted in the specified selector function.</param>
/// <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>
/// <param name="selector">Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="subjectSelector"/> or <paramref name="selector"/> is null.</exception>
public static IObservable<TResult> Multicast<TSource, TIntermediate, TResult>(this IObservable<TSource> source, Func<ISubject<TSource, TIntermediate>> subjectSelector, Func<IObservable<TIntermediate>, IObservable<TResult>> selector)
{
if (source == null)
throw new ArgumentNullException("source");
if (subjectSelector == null)
throw new ArgumentNullException("subjectSelector");
if (selector == null)
throw new ArgumentNullException("selector");
return s_impl.Multicast<TSource, TIntermediate, TResult>(source, subjectSelector, selector);
}
#endregion
#region + Publish +
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence.
/// This operator is a specialization of Multicast using a regular <see cref="System.Reactive.Subjects.Subject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <remarks>Subscribers will receive all notifications of the source from the time of the subscription on.</remarks>
/// <seealso cref="System.Reactive.Subjects.Subject<T>"/>
public static IConnectableObservable<TSource> Publish<TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return s_impl.Publish<TSource>(source);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a regular <see cref="System.Reactive.Subjects.Subject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <seealso cref="System.Reactive.Subjects.Subject<T>"/>
public static IObservable<TResult> Publish<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
return s_impl.Publish<TSource, TResult>(source, selector);
}
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.BehaviorSubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="initialValue">Initial value received by observers upon subscription.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <remarks>Subscribers will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.</remarks>
/// <seealso cref="System.Reactive.Subjects.BehaviorSubject<T>"/>
public static IConnectableObservable<TSource> Publish<TSource>(this IObservable<TSource> source, TSource initialValue)
{
if (source == null)
throw new ArgumentNullException("source");
return s_impl.Publish<TSource>(source, initialValue);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.BehaviorSubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="initialValue">Initial value received by observers upon subscription.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <seealso cref="System.Reactive.Subjects.BehaviorSubject<T>"/>
public static IObservable<TResult> Publish<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TSource initialValue)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
return s_impl.Publish<TSource, TResult>(source, selector, initialValue);
}
#endregion
#region + PublishLast +
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.AsyncSubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <remarks>Subscribers will only receive the last notification of the source.</remarks>
/// <seealso cref="System.Reactive.Subjects.AsyncSubject<T>"/>
public static IConnectableObservable<TSource> PublishLast<TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return s_impl.PublishLast<TSource>(source);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.AsyncSubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <seealso cref="System.Reactive.Subjects.AsyncSubject<T>"/>
public static IObservable<TResult> PublishLast<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
return s_impl.PublishLast<TSource, TResult>(source, selector);
}
#endregion
#region + RefCount +
/// <summary>
/// Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Connectable observable sequence.</param>
/// <returns>An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
public static IObservable<TSource> RefCount<TSource>(this IConnectableObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return s_impl.RefCount<TSource>(source);
}
#endregion
#region + Replay +
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <remarks>Subscribers will receive all the notifications of the source.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source)
{
if (source == null)
throw new ArgumentNullException("source");
return s_impl.Replay<TSource>(source);
}
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all notifications.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
/// <remarks>Subscribers will receive all the notifications of the source.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource>(source, scheduler);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
return s_impl.Replay<TSource, TResult>(source, selector);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource, TResult>(source, selector, scheduler);
}
/// <summary>
/// Returns 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, TimeSpan window)
{
if (source == null)
throw new ArgumentNullException("source");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
return s_impl.Replay<TSource>(source, window);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
return s_impl.Replay<TSource, TResult>(source, selector, window);
}
/// <summary>
/// Returns 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, TimeSpan window, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource>(source, window, scheduler);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, TimeSpan window, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource, TResult>(source, selector, window, scheduler);
}
/// <summary>
/// Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize notifications.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource>(source, bufferSize, scheduler);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, scheduler);
}
/// <summary>
/// Returns 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize)
{
if (source == null)
throw new ArgumentNullException("source");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
return s_impl.Replay<TSource>(source, bufferSize);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
return s_impl.Replay<TSource, TResult>(source, selector, bufferSize);
}
/// <summary>
/// Returns 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, TimeSpan window)
{
if (source == null)
throw new ArgumentNullException("source");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
return s_impl.Replay<TSource>(source, bufferSize, window);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, window);
}
/// <summary>
/// Returns 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers will be invoked on.</param>
/// <returns>A connectable observable sequence that shares a single subscription to the underlying sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <remarks>Subscribers will receive all the notifications of the source subject to the specified replay buffer trimming policy.</remarks>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IConnectableObservable<TSource> Replay<TSource>(this IObservable<TSource> source, int bufferSize, TimeSpan window, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource>(source, bufferSize, window, scheduler);
}
/// <summary>
/// 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.
/// This operator is a specialization of Multicast using a <see cref="System.Reactive.Subjects.ReplaySubject<T>"/>.
/// </summary>
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
/// <param name="source">Source sequence whose elements will be multicasted through a single shared subscription.</param>
/// <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>
/// <param name="bufferSize">Maximum element count of the replay buffer.</param>
/// <param name="window">Maximum time length of the replay buffer.</param>
/// <param name="scheduler">Scheduler where connected observers within the selector function will be invoked on.</param>
/// <returns>An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.</returns>
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="selector"/> or <paramref name="scheduler"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is less than zero.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="window"/> is less than TimeSpan.Zero.</exception>
/// <seealso cref="System.Reactive.Subjects.ReplaySubject<T>"/>
public static IObservable<TResult> Replay<TSource, TResult>(this IObservable<TSource> source, Func<IObservable<TSource>, IObservable<TResult>> selector, int bufferSize, TimeSpan window, IScheduler scheduler)
{
if (source == null)
throw new ArgumentNullException("source");
if (selector == null)
throw new ArgumentNullException("selector");
if (bufferSize < 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (window < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("window");
if (scheduler == null)
throw new ArgumentNullException("scheduler");
return s_impl.Replay<TSource, TResult>(source, selector, bufferSize, window, scheduler);
}
#endregion
}
}
|