/// <summary> /// Clones this instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> public XlsxChartSeriesCollection Clone() { var cloned = new XlsxChartSeriesCollection(Parent) { Properties = Properties.Clone() }; foreach (var serie in this) { cloned.Add(serie.Clone()); } return(cloned); }
/// <summary> /// Combines this instance with reference parameter. /// </summary> /// <param name="reference">The reference.</param> public virtual void Combine(XlsxChartSeriesCollection reference) { if (reference == null) { return; } var hasElements = this.Any(); if (!hasElements) { foreach (var referenceSerie in reference) { var serie = referenceSerie.Clone(); serie.SetOwner(this); Add(serie); } } //else //{ // foreach (var plot in this) // { // var refPlot = reference.GetBy(plot.Name); // if (refPlot != null) // { // plot.Combine(refPlot); // } // } // foreach (var referencePlot in reference) // { // var plot = GetBy(referencePlot.Name); // if (plot != null) // { // continue; // } // var newPlot = referencePlot.Clone(); // newPlot.SetOwner(this); // Add(newPlot); // } //} }