Observable.Queryable.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. #pragma warning disable 1591
  3. namespace System.Reactive.Linq
  4. {
  5. public static partial class Qbservable
  6. {
  7. private static IQbservableProvider s_provider;
  8. /// <summary>
  9. /// Gets the local query provider which will retarget Qbservable-based queries to the corresponding Observable-based query for in-memory execution upon subscription.
  10. /// </summary>
  11. public static IQbservableProvider Provider
  12. {
  13. get
  14. {
  15. if (s_provider == null)
  16. s_provider = new ObservableQueryProvider();
  17. return s_provider;
  18. }
  19. }
  20. /// <summary>
  21. /// Converts an in-memory observable sequence into an IQbservable&lt;T&gt; sequence with an expression tree representing the source sequence.
  22. /// </summary>
  23. /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
  24. /// <param name="source">Source sequence.</param>
  25. /// <returns>IQbservable&lt;T&gt; sequence representing the given observable source sequence.</returns>
  26. /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
  27. public static IQbservable<TSource> AsQbservable<TSource>(this IObservable<TSource> source)
  28. {
  29. if (source == null)
  30. throw new ArgumentNullException("source");
  31. return new ObservableQuery<TSource>(source);
  32. }
  33. }
  34. }
  35. #pragma warning restore 1591