public void ReplaceWithRange(T from, T to) { var iFrom = _allItems.IndexOf(from); var iTo = _allItems.IndexOf(to); if (iFrom < 0 || iTo < 0) { return; //normally unreachable code } if (iFrom > iTo) { var tmp = iFrom; iFrom = iTo; iTo = tmp; } _selectedItems.Replace( _allItems.Skip(iFrom).Take(iTo - iFrom + 1)); }