public virtual IEnumerator <IGridRow <T> > GetEnumerator() { if (CurrentRows == null) { IQueryable <T> items = Grid.Source; foreach (IGridProcessor <T> processor in Grid.Processors.Where(proc => proc.ProcessorType == GridProcessorType.Pre)) { items = processor.Process(items); } foreach (IGridProcessor <T> processor in Grid.Processors.Where(proc => proc.ProcessorType == GridProcessorType.Post)) { items = processor.Process(items); } CurrentRows = items .ToList() .Select(model => new GridRow <T>(model) { CssClasses = CssClasses?.Invoke(model) }); } return(CurrentRows.GetEnumerator()); }