2
Reply

What is lock statement in C#?

Rohan  Rathore

Rohan Rathore

11y
1.3k
0
Reply

    Exclusive locking in threading ensures that one thread does not enter a critical section while another thread is in the critical section of code. If another thread attempts to enter a locked code, it will wait (block) until the object is released.

    It is a syntactical sugar that wraps up a Monitor in to a try / finally block that ensures that the Monitor is closed when the coding block exits.