fix some existing issues
This commit is contained in:
@@ -29,6 +29,29 @@ public class RollingList<T> : IEnumerable<T>
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetLast(out T value)
|
||||
{
|
||||
lock (_addLock)
|
||||
{
|
||||
if (_list.Count == 0)
|
||||
{
|
||||
value = default!;
|
||||
return false;
|
||||
}
|
||||
|
||||
value = _list.Last!.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public List<T> Snapshot()
|
||||
{
|
||||
lock (_addLock)
|
||||
{
|
||||
return new List<T>(_list);
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(T value)
|
||||
{
|
||||
lock (_addLock)
|
||||
|
||||
Reference in New Issue
Block a user