/// <summary> /// Gets the <typeparamref name="TValue" /> for the specified <paramref name="key" />. /// </summary> /// <typeparam name="TKey">The type of the key.</typeparam> /// <typeparam name="TValue">The type of the value.</typeparam> /// <param name="cache">The cache to use.</param> /// <param name="key">The key to retrieve the <typeparamref name="TValue" /> for.</param> /// <param name="throwIfExpired">If set to <c>true</c>, a <see cref="KeyHasExpiredException{TKey}"/> will be thrown if it has expired before retrieval.</param> /// <param name="scheduler">Scheduler to perform the retrieval on.</param> /// <returns> /// An observable stream that returns the <typeparamref name="TValue"/> for the provided <paramref name="key" />. /// </returns> public static IObservable <TValue> Get <TKey, TValue>(this IObservableCache <TKey, TValue> cache, TKey key, bool throwIfExpired = true, IScheduler scheduler = null) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(cache.Get(Observable.Return(key), throwIfExpired, scheduler)); }