Cysharp / ObservableCollections

High performance observable collections and synchronized views, for WPF, Blazor, Unity.
MIT License
461 stars 36 forks source link

Add a dedicated event type for SynchronizedView #30

Closed hadashiA closed 4 months ago

hadashiA commented 4 months ago

What we would like to improve:

So change parameters for SynchronizedView.OnCollectionChanged.

Before:

void OnCollectionChanged(ChangedKind changedKind, T value,  TView view,   in NotifyCollectionChangedEventArgs<int> eventArgs);

After:

public readonly struct SynchronizedViewChangedEventArgs<T, TView>
{
    public readonly NotifyCollectionChangedAction Action = action;
    public readonly T NewValue = newValue;
    public readonly T OldValue = oldValue;
    public readonly TView NewView = newView;
    public readonly TView OldView = oldView;
    public readonly int NewViewIndex = newViewIndex;
    public readonly int OldViewIndex = oldViewIndex;
}

void OnCollectionChanged(in SynchronizedViewChangedEventArgs<int, ViewModel> eventArgs);