PdfPrep.com

What should you do?

You are adding a public method named UpdateScore to a public class named ScoreCard.

The code region that updates the score field must meet the following requirements:

• It must be accessed by only one thread at a time.

• It must not be vulnerable to a deadlock situation.

You need to implement the UpdateScore() method.

What should you do?

A . Option A
B . Option B
C . Option C
D . Option D

Answer: B

Explanation:

Because the class is public, you need a private lock Object.

Reference: lock vs. MethodImplOptions.Synchronized [Kit George]

http://blogs.msdn.com/b/bclteam/archive/2004/01/20/60719.aspx

Exit mobile version