public void SetElement(int index, int ordinatesOffset, ElementType et, int numCompounds) { if (index > this.Size) { throw new IndexOutOfRangeException("Attempted to set more elements in ElementInfo array than capacity."); } var startIndexOfTriplet = index * 3; this.Elements[startIndexOfTriplet] = new decimal(ordinatesOffset); this.Elements[startIndexOfTriplet + 1] = et.EType(); this.Elements[startIndexOfTriplet + 2] = et.IsCompound() ? new decimal(numCompounds) : et.Interpretation(); }