[英]Is there a c# equivalent of Java ConcurrentHashMap
我需要c#中的字典/ hashmap,允許您執行以下操作
謝謝
看看System.Collections.Concurrent - 命名空間! http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx
對於我來說,這聽起來像ConcurrentDictionary<TKey, TValue>
,如果您安裝了Reactive Extensions ,則可以在.NET 4.0 或 .NET 3.5中使用。
在這里查看ConcurrentDictionary: http : //msdn.microsoft.com/en-us/library/dd287191.aspx 。 這應該做你想要的。 請記住,它只是.Net 4。
您也可以使用ReaderWriterLockSlim Class
編寫自己的ReaderWriterLockSlim Class
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.