Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Why to use lock statement in C#?
Home
C Sharp
Why to use lock statement in C#?
0
votes
asked
Oct 18, 2019
in
C Sharp
by
Robin
Why to use lock statement in C#?
lock-statement
statement-in-c#
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 18, 2019
by
rajeshsharma
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.
Related questions
0
votes
Q: What is the lock statement in C#?
asked
May 6, 2020
in
C Sharp
by
SakshiSharma
#lock-statement
0
votes
Q: Why to use “Nullable Coalescing Operator” (??) in C#?
asked
Oct 18, 2019
in
C Sharp
by
Robin
c#-nullable
nullable-in-c#
0
votes
Q: Why to use “finally” block in C#?
asked
Oct 18, 2019
in
C Sharp
by
Robin
finally-c#
c#-finally
0
votes
Q: Why to use keyword “const” in C#? Give an example.
asked
Oct 18, 2019
in
C Sharp
by
Robin
const-in-c#
c#-in-const
0
votes
Q: Why to use “using” in C#?
asked
Oct 18, 2019
in
C Sharp
by
Robin
using-in-c#
c#-using
0
votes
Q: Whats the C# equivalent of C++ catch ( ), which was a catch-all statement for any possible exception?
asked
Mar 5, 2020
in
C Sharp
by
JackTerrance
0
votes
Q: In try block if we add return statement whether finally block is executed in C#?
asked
Oct 18, 2019
in
C Sharp
by
Robin
c#
0
votes
Q: What are the main reasons to use C# language?
asked
May 6, 2020
in
C Sharp
by
SakshiSharma
#reason-c#
#c#-reason
#c-sharp-reason
0
votes
Q: Reserved keywords can be use as identifiers in C#?
asked
Jun 16, 2020
in
C Sharp
by
Hodge
#csharp
0
votes
Q: Can we use delegates for asynchronous method calls in C#?
asked
Oct 18, 2019
in
C Sharp
by
Robin
c#-delegates
delegates
...