Fix incrementing -1 indices

Fixes https://github.com/Cysharp/ObservableCollections/issues/89
This commit is contained in:
erri120 2024-12-13 17:05:58 +01:00
parent a16edc16ed
commit 7c4974c36a
No known key found for this signature in database

View File

@ -167,10 +167,12 @@ sealed class ObservableCollectionChanged<T>(IObservableCollection<T> collection,
eventArgs.Action,
item,
eventArgs.OldItem,
i++,
newStartingIndex: i,
eventArgs.OldStartingIndex,
eventArgs.SortOperation);
if (eventArgs.NewStartingIndex != -1) i++;
observer.OnNext(newArgs);
}
}