public override DataTableEx getSubTable(int FromId, int lng) { //DataTableEx ret = null; DataTableEx DataCopy = CarTable.Copy(); if (lng * 2 > DataCopy.Rows.Count) { for (int i = FromId + lng; i < DataCopy.Rows.Count; i++) { DataCopy.Rows.RemoveAt(i); } for (int i = FromId - 1; i >= 0; i--) { DataCopy.Rows.RemoveAt(i); } return(DataCopy); } DataTableEx ret = DataCopy.Clone() as DataTableEx; for (int i = FromId; i < FromId + lng; i++) { ret.Rows.Add(DataCopy.Rows[i].ItemArray); } return(ret); }