Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ public void Move(int oldIndex, int newIndex)
}
}

public void Reset()
{
var notifyAndWait = WaitOnNotifying;

if (notifyAndWait)
_ReaderWriterLockSlim.EnterUpgradeableReadLock();
try
{
OnPropertyChanged(nameof(Count));
OnPropertyChanged(_IndexerName);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
finally
{
if (notifyAndWait)
_ReaderWriterLockSlim.ExitUpgradeableReadLock();
}
}

public new void Add(T item)
{
var notifyAndWait = WaitOnNotifying;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,26 @@ public bool WaitOnNotifying
return result;
}

public void Reset()
{
var notifyAndWait = WaitOnNotifying;

if (notifyAndWait)
_ReaderWriterLockSlim.EnterUpgradeableReadLock();
try
{
OnPropertyChanged(nameof(Keys));
OnPropertyChanged(nameof(Values));
OnPropertyChanged(nameof(Count));
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
finally
{
if (notifyAndWait)
_ReaderWriterLockSlim.ExitUpgradeableReadLock();
}
}

#if NET6_0_OR_GREATER
public new bool TryAdd(TKey key, TValue value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface IObservableCollectionThreadSafe : ICollectionThreadSafe, IBinda
{
#region methods
void Move(int oldIndex, int newIndex);
void Reset();
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace ThunderDesign.Net.Threading.Interfaces
{
public interface IObservableDictionaryThreadSafe : IDictionaryThreadSafe, IBindableCollection
{
void Reset();
}

public interface IObservableDictionaryThreadSafe<TKey, TValue> : IDictionaryThreadSafe<TKey, TValue>, IObservableDictionaryThreadSafe
Expand Down
Loading