public void Trim(int size) { while (size < this.postinglist.Count) { var last = this.postinglist.Count - 1; var t = this.postinglist [last]; if (t != null && t.Count > 0) { this.numberOfItems -= t.Count; } this.postinglist.RemoveAt(last); } }