internal static void CopyFrom(KeyedCollection <string, ServiceLoadMetricDescription> source, KeyedCollection <string, ServiceLoadMetricDescription> target) { if (source != null) { target.Clear(); source.ForEach(m => { ServiceLoadMetricDescription casted; if (m is StatefulServiceLoadMetricDescription) { casted = new StatefulServiceLoadMetricDescription(m as StatefulServiceLoadMetricDescription); } else if (m is StatelessServiceLoadMetricDescription) { casted = new StatelessServiceLoadMetricDescription(m as StatelessServiceLoadMetricDescription); } else { casted = new ServiceLoadMetricDescription(m); } target.Add(casted); }); } }