Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether the specified <paramref name="key"/> is an element of the <paramref name="cache"/>.
        /// </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 check.</param>
        /// <param name="scheduler">The scheduler to run check on.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static IObservable <bool> Contains <TKey, TValue>(this IObservableCache <TKey, TValue> cache, TKey key, IScheduler scheduler = null)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            return(cache.Contains(Observable.Return(key), scheduler));
        }