mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
Delegate for comparisons
This commit is contained in:
@@ -77,11 +77,11 @@ namespace MQTTnet.Internal
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveFirstIfEqual(TItem item)
|
||||
public void RemoveFirstIfEqual(TItem item, Func<TItem, TItem, bool> areEqual)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_items.Count > 0 && EqualityComparer<TItem>.Default.Equals(_items.First.Value, item))
|
||||
if (_items.Count > 0 && areEqual(_items.First.Value, item))
|
||||
{
|
||||
_items.RemoveFirst();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user