mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-11-01 03:32:38 +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)
|
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();
|
_items.RemoveFirst();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user