c# Adding a Remove(int index) method to the .NET Queue class

前端 未结 12 1538
攒了一身酷
攒了一身酷 2021-01-07 17:14

I would like to use the generic queue class as described in the .NET framework (3.5) but I will need a Remove(int index) method to remove items from the queue. Can I achieve

12条回答
  •  北荒
    北荒 (楼主)
    2021-01-07 17:52

    David Anderson's solution is probably the best but has some overhead. Are you using custom objects in the queue? if so, add a boolean like cancel

    Check with your workers that process the queue if that boolean is set and then skip it.

提交回复
热议问题