/// <summary> /// Removes order by id /// </summary> /// <param name="orderId"></param> /// <returns>Removal result.</returns> public bool RemoveOrder(ulong orderId) { var order = GetOrder(orderId); if (order == null) { return(false); } var next = order.Next; var prev = order.Prev; if (Head == order) { Head = next; } if (Tail == order) { Tail = prev; } if (prev != null) { prev.Next = next; } if (next != null) { next.Prev = prev; } orderMap.RemoveOrder(orderId); Count--; return(true); }
/// <summary> /// Removes order by id /// </summary> /// <param name="orderId"></param> /// <returns>Removal result.</returns> public virtual bool RemoveOrder(ulong orderId, out Order order) { if (!orderMap.RemoveOrder(orderId, out order)) { return(false); } var next = order.Next; var prev = order.Prev; if (Head == order) { Head = next; } if (Tail == order) { Tail = prev; } if (prev != null) { prev.Next = next; } if (next != null) { next.Prev = prev; } Count--; return(true); }