using System; using System.Collections; using System.Collections.Generic; namespace CPF.ReoGrid.Outline { public class OutlineCollectionProperty : IEnumerable, IEnumerable where T : ReoGridOutline { internal OutlineCollectionProperty(Worksheet worksheet, RowOrColumn rowOrColumn) { this.worksheet = worksheet; this.rowOrColumn = rowOrColumn; } public T AddOutline(int start, int count) { return (T)((object)this.worksheet.AddOutline(this.rowOrColumn, start, count)); } public T RemoveOutline(int start, int count) { return (T)((object)this.worksheet.RemoveOutline(this.rowOrColumn, start, count)); } public T this[int start, int count] { get { return (T)((object)this.worksheet.GetOutline(this.rowOrColumn, start, count)); } } private IEnumerator GetEnum() { foreach (OutlineGroup og in this.worksheet.GetOutlines(this.rowOrColumn)) { foreach (ReoGridOutline o in og) { yield return (T)((object)o); } } } public IEnumerator GetEnumerator() { return this.GetEnum(); } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnum(); } private Worksheet worksheet; private RowOrColumn rowOrColumn; } }