public void RemoveRow(int index) { if (index < 0 || index >= DataList.Count) throw new IndexOutOfRangeException(string.Format("所提供的的索引超出了行数的范围,当前共{0}行", DataList.Count.ToString())); DataList.RemoveAt(index); int len = 0; if (PositionMapping.ContainsKey(index + 1)) { len = PositionMapping[index + 1] - PositionMapping[index]; TableBuilder.Remove(PositionMapping[index], len); var keys=PositionMapping.Keys.ToList(); foreach (int i in keys) { if (PositionMapping.ContainsKey(i + 1)) { PositionMapping[i] = PositionMapping[i + 1] - len; } } PositionMapping.Remove(DataList.Count); } else { len = TableBuilder.Length - PositionMapping[index] - 1; TableBuilder.Remove(PositionMapping[index], len); PositionMapping.Remove(index); } if (Index >= DataList.Count) Index = DataList.Count - 1; }