Example #1
0
        /// <summary>
        /// Provides an implementation of <see cref="ISet{T}.Overlaps"/>.
        /// </summary>
        /// <typeparam name="T">The type of values in the collections.</typeparam>
        /// <param name="source">The source collection that is implementing <see cref="ISet{T}"/>.</param>
        /// <param name="other">The other enumerable.</param>
        /// <returns>The result of <see cref="ISet{T}.Overlaps"/>.</returns>
        /// <remarks>
        /// From <see href="https://msdn.microsoft.com/en-us/library/dd412095(v=vs.110).aspx"/>;
        /// Determines whether the current set overlaps with the specified collection.
        /// </remarks>
        public static bool Overlaps <T>(ISet <T> source, IEnumerable <T> other)
        {
            Contracts.Requires.That(source != null);
            ISetContracts.Overlaps(other);

            if (source.Count == 0 || other.IsEmpty())
            {
                return(false);
            }

            return(other.Any(source.Contains));
        }
Example #2
0
        /// <inheritdoc />
        public bool Overlaps(IEnumerable <IDisposable> other)
        {
            ISetContracts.Overlaps(other);

            return(this.disposables.Overlaps(other));
        }