public bool UpdateWhenChanged(IEnumerable <MetricDefinition> metricDefinitions) { if (this.MetricDefinitions == null || !this.MetricDefinitions.SequenceEqual( metricDefinitions, GenericEqualityComparer <MetricDefinition> .CreateComparer((a, b) => a.ValueEquals(b), a => a.GetHashCode()))) { this.MetricDefinitions = metricDefinitions; return(true); } return(false); }