/// <summary>Trims the range from the right.</summary> /// <typeparam name="T">The type of the range values.</typeparam> /// <param name="compositeRange">The source range.</param> /// <param name="to">A new boundary To.</param> /// <returns>A range trimmed with a new To boundary.</returns> public static CompositeRange <T> TrimTo <T>(this CompositeRange <T> compositeRange, RangeBoundaryTo <T> to) => compositeRange.Intersect(Range.TryCreate(RangeBoundaryFrom <T> .NegativeInfinity, to));
/// <summary>Trims the range from the left.</summary> /// <typeparam name="T">The type of the range values.</typeparam> /// <param name="compositeRange">The source range.</param> /// <param name="from">A new boundary From.</param> /// <returns>A range trimmed with a new From boundary.</returns> public static CompositeRange <T> TrimFrom <T>(this CompositeRange <T> compositeRange, RangeBoundaryFrom <T> from) => compositeRange.Intersect(Range.TryCreate(from, RangeBoundaryTo <T> .PositiveInfinity));