/// <summary> /// return true if the input range fully or partially overlaps this range. /// </summary> /// <param name="Range"></param> /// <returns></returns> public bool ContainsAny(RowColRange Range) { bool contains = false; // the input range starts somewhere within this range. if (this.Contains(Range.From)) { contains = true; } // the input range ends somewhere within this range. else if (this.Contains(Range.To)) { contains = true; } // the input range starts before and ends after this range. That is, the // input range completely overlaps this range. else if ((Range.From.CompareTo(this.From) < 0) && (Range.To.CompareTo(this.To) > 0)) { contains = true; } return(contains); }
public bool CompletelyContains(RowColRange Range) { bool contains = false; if (this.From.CompareTo(Range.From) <= 0) { if (this.To.CompareTo(Range.To) >= 0) { contains = true; } } return(contains); }