add overload WritableFiltable ToWritableNotifyCollectionChanged()

This commit is contained in:
zerodev1200 2024-10-17 23:20:29 +09:00
parent 290b455c47
commit 367be8717c
2 changed files with 12 additions and 0 deletions

View File

@ -58,6 +58,7 @@ namespace ObservableCollections
void SetToSourceCollection(int index, T value); void SetToSourceCollection(int index, T value);
void AddToSourceCollection(T value); void AddToSourceCollection(T value);
IWritableSynchronizedViewList<TView> ToWritableViewList(WritableViewChangedEventHandler<T, TView> converter); IWritableSynchronizedViewList<TView> ToWritableViewList(WritableViewChangedEventHandler<T, TView> converter);
NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged();
NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter); NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter);
NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(ICollectionEventDispatcher? collectionEventDispatcher); NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(ICollectionEventDispatcher? collectionEventDispatcher);
NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter, ICollectionEventDispatcher? collectionEventDispatcher); NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter, ICollectionEventDispatcher? collectionEventDispatcher);

View File

@ -373,6 +373,17 @@ namespace ObservableCollections
return new FiltableSynchronizedViewList<T, TView>(this, isSupportRangeFeature: true, converter: converter); return new FiltableSynchronizedViewList<T, TView>(this, isSupportRangeFeature: true, converter: converter);
} }
public NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged()
{
return new FiltableSynchronizedViewList<T, TView>(this,
isSupportRangeFeature: false,
converter: static (TView newView, T originalValue, ref bool setValue) =>
{
setValue = true;
return originalValue;
});
}
public NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter) public NotifyCollectionChangedSynchronizedViewList<TView> ToWritableNotifyCollectionChanged(WritableViewChangedEventHandler<T, TView> converter)
{ {
return new FiltableSynchronizedViewList<T, TView>(this, isSupportRangeFeature: false, converter: converter); return new FiltableSynchronizedViewList<T, TView>(this, isSupportRangeFeature: false, converter: converter);