.net collection for fast insert/delete

后端 未结 6 1270
梦毁少年i
梦毁少年i 2021-01-30 11:43

I need to maintain a roster of connected clients that are very shortlived and frequently go up and down. Due to the potential number of clients I need a collection that supports

6条回答
  •  逝去的感伤
    2021-01-30 12:23

    Well, how much do you need to query it? A linked-list has fast insert/delete (at any position), but isn't as quick to search as (for example) a dictionary / sorted-list. Alternatively, a straight list with a bit/value pair in each - i.e. "still has value". Just re-use logically empty cells before appending. Delete just clears the cell.

    For reference types, "null" would do here. For value-types, Nullable.

提交回复
热议问题