.net collection for fast insert/delete

后端 未结 6 1154
梦毁少年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:36

    Consider the hash-based collections for this, e.g. HashSet, Dictionary, HashTable, which provide constant time performance for adding and removing elements.

    More information from the .NET Framework Developer's Guide:

    • Hashtable and Dictionary Collection Types
    • HashSet Collection Type

提交回复
热议问题