Threadsafe collection without lock

后端 未结 5 2031
一个人的身影
一个人的身影 2020-12-13 00:59

I am preparing myself for an interview and I came across the followign question. I tried but I could not find anything which can create a class containing thread safe collec

5条回答
  •  爱一瞬间的悲伤
    2020-12-13 01:34

    Based on the question you should be able to add a concurrent collection inside your object that will handle the thread safety requirements for you. They did not specify what type of internal collection to use.

    You should be able to implement one of the collections from the concurrentcollection namespace and achieve this.

    http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx

提交回复
热议问题