/// <summary>Determines whether the composite range contains another range.</summary>
        /// <typeparam name="TKey2">The type of the key of another range.</typeparam>
        /// <param name="other">The range to check.</param>
        /// <returns><c>true</c>, if the composite range contains another range.</returns>
        public bool Contains <TKey2>(CompositeRange <T, TKey2> other)
        {
            if (IsEmpty && other.IsEmpty)
            {
                return(true);
            }
            if (!ContainingRange.Contains(other.ContainingRange))
            {
                return(false);
            }

            var result = true;

            using (var containingRanges = GetMergedRanges().GetEnumerator())
            {
                var hasContainingRange = containingRanges.MoveNext();
                foreach (var otherRange in other.GetMergedRanges())
                {
                    while (hasContainingRange && containingRanges.Current.EndsBefore(otherRange))
                    {
                        hasContainingRange = containingRanges.MoveNext();
                    }

                    if (!hasContainingRange || !containingRanges.Current.Contains(otherRange))
                    {
                        result = false;
                        break;
                    }
                }
            }

            return(result);
        }
        public bool Contains(

            #region T4-dont-replace
            Range <T> other
            #endregion

            ) =>
        ContainingRange.Contains(other) &&
        GetMergedRanges().Any(r => r.Contains(other));
        public Range <T>[] GetIntersection(T value)
        {
            var ranges = new List <Range <T> >();

            if (!ContainingRange.Contains(value))
            {
                return(Array <Range <T> > .Empty);
            }

            foreach (var range in SubRanges)
            {
                if (range.StartsAfter(value))
                {
                    break;
                }
                if (range.Contains(value))
                {
                    ranges.Add(range);
                }
            }
            return(ranges.ToArray());
        }
 public bool Contains <TKey2>(Range <T, TKey2> other) =>
 ContainingRange.Contains(other) &&
 GetMergedRanges().Any(r => r.Contains(other));
 public bool Contains(RangeBoundaryTo <T> other) =>
 ContainingRange.Contains(other) &&
 SubRanges.Any(r => r.Contains(other));
 public bool Contains(T value) =>
 ContainingRange.Contains(value) &&
 SubRanges.Any(r => r.Contains(value));