I will try to answer following questions in this article:How many threads are available in .NET thread pool?How long does the CLR take to create a new Non-thread-pool thread?How long does the CLR take to schedule a task on a thread-pool thread?How long does the CLR take to create a new thread-pool thread when it does not have enough thread available in the pool? How many threads are available in .NET thread pool? Code: Output: The min number of workerThreads is 8. It is the number of threads available ......
Had this question when I was reading “Effective C#: 50 Specific Ways to Improve Your C#”. In the item 18: "Implement the Standard Dispose Pattern", the book recommends to implements IDisposable.Dispose() to do following tasks: 1. Freeing all unmanaged resources. 2. Freeing all managed resource (this includes unhooking events). 3. … My question is on point 2, why do we have to unhook events? After having a look of how System.Delegate is implemented, I found the reason is actually quite simple. To ......