Concurrent Dictionary Correct Usage

前端 未结 5 935
名媛妹妹
名媛妹妹 2020-12-13 05:27

Am I right in thinking this is the correct use of a Concurrent Dictionary

private ConcurrentDictionary myDic = new ConcurrentDictionary

        
5条回答
  •  失恋的感觉
    2020-12-13 05:58

    Best way to find this out is check MSDN documentation.

    For ConcurrentDictionary the page is http://msdn.microsoft.com/en-us/library/dd287191.aspx

    Under thread safety section, it is stated "All public and protected members of ConcurrentDictionary(Of TKey, TValue) are thread-safe and may be used concurrently from multiple threads."

    So from concurrency point of view you are okay.

提交回复
热议问题