In this article, I am going to show you how to use the IDisposable interface correctly in your code. When I read other’s code, it is easy to pick up on subtle bugs. We need to begin to train ourselves to see the bugs and we do this by understanding what we are using. Before we begin, we need to make sure that we understand a core piece of computer science theory: Destructors.
In this post, I am going to show a small micro-benchmark to demonstrate the performance difference between the Semaphore and SemaphoreSlim classes in C#. A Semaphore is often used to restrict the number of threads than can access some (physical or logical) resource. In this case, we want the restriction to be as little as possible.
Stuart Blackler is a seasoned technologist with over 15 years of commercial experience in the .NET ecosystem.
Holding a degree in Computer Science, Stuart has earned
certifications as a C# developer through Microsoft and as an AWS Solutions Architect and Developer. Stuart is
the creator of the popular YouTube channel CodeWithStu, where he delves into topics close to his heart, including .NET, AWS, DevOps,
and software architecture with a commitment to sharing knowledge and fostering a community of learners.