public override IEnumerable <SkylineDocNode> GetSelectedNodes(BoundDataGridView dataGridView) { var rowItemValues = RowItemValues.FromDataGridView(typeof(Precursor), dataGridView); foreach (var rowItem in rowItemValues.GetSelectedRowItems(dataGridView)) { foreach (var precursor in rowItemValues.GetRowValues(rowItem).Cast <Precursor>()) { yield return(precursor); } } foreach (var transition in Transitions.GetSelectedNodes(dataGridView)) { yield return(((Entities.Transition)transition).Precursor); } }