2
Reply

Why to use lock statement in C#?

Vivek Kumar

Vivek Kumar

Feb 08, 2016
386
0

    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.

    Ayappan Alagesan
    February 12, 2017
    0

    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

    Vivek Kumar
    February 08, 2016
    0