Do I need to Dispose a SemaphoreSlim

前端 未结 4 1184
梦毁少年i
梦毁少年i 2021-01-03 20:15

According to the documentation:

\"a SemaphoreSlim doesn\'t use a Windows kernel semaphore\".

Are there any special

4条回答
  •  悲哀的现实
    2021-01-03 20:17

    You should always call Dispose() on any class implementing IDisposable (or put it inside a using statement) and not base your decision on its internal implementation. The class author already made that decision for you by implementing the IDisposable interface.

提交回复
热议问题