Perhaps the most commonly used way in C# is the 'lock' statement which prevents multiple threads from entering a block of code at the same time. The threads queue up until the current thread has finished processing the block.

However, there are many other ways including Mutexes and Semaphores.