public bool RemoveOrder(string orderId, out LimitOrder order) { var success = Orders.Remove(orderId, out order); if (success) { TotalLevelQuantity -= order.Quantity; NumberOfOrders -= 1; } else { order = null; } return(success); }
public bool Contains(string orderId, out LimitOrder order) { LinkedListNode <LimitOrder> node; bool contain = Table.TryGetValue(orderId, out node); if (contain) { order = node.Value; } else { order = null; } return(contain); }
public bool Remove(string orderId, out LimitOrder order) { LinkedListNode <LimitOrder> node; bool contain = Table.TryGetValue(orderId, out node); if (contain) { order = node.Value; List.Remove(node); if (!Table.Remove(order.OrderId)) { throw new Exception(string.Format("Can't find orderId = {0} when removing!", order.OrderId)); } } else { order = null; } return(contain); }