Why to use lock statement in C#?
Vivek Kumar
In case a multiple threads is executed at-a-time the application may be crashed. "Lock" does a beautiful job which is "Make to execute one thread at-a-time" remaining will be waiting till that processing thread complete its work.
Lock will make sure one thread will not intercept the other thread which is running the part of code. So lock statement will make the thread wait, block till the object is being released