Synchronization lock can be used in C# to ensure that only one thread at at time can enter the locked section of the code. The syntax is pretty simple.
lock (this)
{
// do your work
}
Here, "this" is the lock identifier and the current instance of the class. You can create a separate object and specify as the lock identifier too.