namespace InspectionUI.ViewModels { using System.Collections; using System.Collections.Generic; public abstract class ItemsGridVM : VM, IEnumerable { private readonly List rows; protected ItemsGridVM() : base() { this.rows = new List(); } public IEnumerator GetEnumerator() { return this.rows.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } protected void Add(ItemsGridRowVM item) { this.rows.Add(item); } protected void Clear() { foreach (var item in this.rows) { item.Dispose(); } this.rows.Clear(); } protected int IndexOf(ItemsGridRowVM item) { return this.rows.IndexOf(item); } protected void Insert(int index, ItemsGridRowVM item) { this.rows.Insert(index, item); } } }