C Sharp Programming/Keywords/lock

The keyword allows a section of code to exclusively use a resource, a feature useful in multi-threaded applications. If a lock to the specified object is already held when a piece of code tries to lock the object, the code's thread is blocked until the object is available.

The parameter to the lock statement must be an object reference, not a value type:

/Keywords