Can a ThreadStatic IDisposable be automatically disposed?

前端 未结 1 856
再見小時候
再見小時候 2021-01-03 01:44

This is not a question of how to automatically call dispose - my problem is the opposite: I have a thread pool where each thread has a ThreadStatic Graphics (which was creat

相关标签:
1条回答
  • 2021-01-03 02:35

    If the thread dies completely then the ThreadStatic object for that thread can be collected.

    The GC won't call Dispose directly, but if the object has a "fallback" finaliser to clean-up after itself then the GC should call that at some point during the collection process.

    0 讨论(0)
提交回复
热议问题