public override bool Equals(object obj) { BaseLevelExperimentViewModel experimentWrapper = obj as BaseLevelExperimentViewModel; if (experimentWrapper != null) { return(m_experiment.Equals(experimentWrapper.GetExperiment())); } IExperiment experiment = obj as IExperiment; //at this moment it is not known it is not TopLevelExperimentViewModel, so it is actual m_experiment if (experiment != null) { return(m_experiment.Equals(experiment)); } return(base.Equals(obj)); }