My code is almost alike, but sends in an IList<T> as parameter (UnitCollection is a BindableCollection<Unit>):
var list = Units.Where(t => t.Primary).ToList();
UnitCollection.Clear()
UnitCollection.AddRange(list);
The UnitCollection is set as ItemSource for a ListView in the GUI (xaml). The NotSupportedException is thrown by the System.Windows.Data.ListCollectionView when method «ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)» calls «this.ValidateCollectionChangedEventArgs(args)»
protectedoverridevoid ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) {if (args == null) {thrownew ArgumentNullException("args"); }this.ValidateCollectionChangedEventArgs(args); ...
and
privatevoid ValidateCollectionChangedEventArgs(NotifyCollectionChangedEventArgs e) {switch (e.Action) {case NotifyCollectionChangedAction.Add:if (e.NewItems.Count != 1) {thrownew NotSupportedException(SR.Get("RangeActionsNotSupported")); }break; ...