private IEnumerable<SnapshotSpan> Split(SnapshotSpan span, IEnumerable<SnapshotSpan> remove) { var removeNorm = new NormalizedSnapshotSpanCollection(remove); foreach (var r in removeNorm.OrderBy(x => x.Start.Position)) { if (r.Start < span.End) { if (r.Start > span.Start) { yield return new SnapshotSpan(span.Start, r.Start); } if (r.End < span.End) { span = new SnapshotSpan(r.End, span.End); } else { yield break; } } } yield return span; }
private IEnumerable <SnapshotSpan> Split(SnapshotSpan span, IEnumerable <SnapshotSpan> remove) { var removeNorm = new NormalizedSnapshotSpanCollection(remove); foreach (var r in removeNorm.OrderBy(x => x.Start.Position)) { if (r.Start < span.End) { if (r.Start > span.Start) { yield return(new SnapshotSpan(span.Start, r.Start)); } if (r.End < span.End) { span = new SnapshotSpan(r.End, span.End); } else { yield break; } } } yield return(span); }