public GhostPoint2DCollection(GhostPoint2D[] ghostPoints, int capacity) { Capacity = capacity; CurrentCount = ghostPoints.Length; if (Capacity < CurrentCount) { throw (new CollectionCapacityException()); } GhostPoints = ghostPoints; }
public void Union(GhostPoint2DCollection ghostPoint2DCollection) { Capacity += ghostPoint2DCollection.Capacity; GhostPoint2D[] ghostPoints = new GhostPoint2D[Capacity]; this.GhostPoints.CopyTo(ghostPoints, 0); ghostPoint2DCollection.GhostPoints.CopyTo(ghostPoints, this.Count); this.GhostPoints = ghostPoints; CurrentCount += ghostPoint2DCollection.Count; }
public void Add(GhostPoint2D ghostPoint) { try { base.Add(); } catch (CollectionCapacityException e) { string emsg = e.Message; this.Capacity *= 2; GhostPoint2D[] ghostPoints = new GhostPoint2D[Capacity]; this.GhostPoints.CopyTo(ghostPoints, 0); this.GhostPoints = ghostPoints; base.Add(); } GhostPoints[CurrentCount - 1] = ghostPoint; }
public GhostPoint2DCollection(GhostPoint2D[] ghostPoints) { Capacity = ghostPoints.Length; GhostPoints = ghostPoints; CurrentCount = Capacity; }