using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; namespace FlexFramework.Excel { /// /// A collection of /// public class Row : ReadOnlyCollection, ICloneable { public IList Cells { get { return Items; } } public Cell this[string address] { get { if (!Address.IsValid(address)) throw new FormatException(); return this[new Address(address)]; } } public Cell this[Address address] { get { return this.First(cell => cell.Address == address); } } public IEnumerable this[Range range] { get { return this.Where(cell => range.Contains(cell.Address)); } } public Row(IList list) : base(list) { } public Row() : base(new List()) { } public Row DeepClone() { return new Row(Items.Select(cell => cell.DeepClone()).ToList()); } public Row ShallowClone() { return (Row)MemberwiseClone(); } } }