You develop an application by using C#. The application counts the number of times a specific word appears within a set of text files. The application includes the following code.
(Line numbers are included for reference only.)

You have the following requirements:
* Populate the _wordCounts object with a list of words and the number of occurrences of each word.
* Ensure that updates to the ConcurrentDictionary object can happen in parallel.
You need to complete the relevant code.
Which code segment should you insert at line 23?

Correct Answer: A
Explanation: The ConcurrentDictionary<TKey,TValue>.AddOrUpdate method adds a key/value pair to the ConcurrentDictionary<TKey,TValue> if the key does not already exist, or updates a key/value pair in the ConcurrentDictionary<TKey,TValue> if the key already exists.
Example:
// Construct a ConcurrentDictionary
ConcurrentDictionary<int, int> cd = new ConcurrentDictionary<int, int>();
// Bombard the ConcurrentDictionary with 10000 competing AddOrUpdates
Parallel.For(0, 10000, i =>
{
// Initial call will set cd[1] = 1.
// Ensuing calls will set cd[1] = cd[1] + 1
cd.AddOrUpdate(1, 1, (key, oldValue) => oldValue + 1);
});
Console.WriteLine("After 10000 AddOrUpdates, cd[1] = {0}, should be 10000", cd[1]); Reference: ConcurrentDictionary<TKey,TValue>.AddOrUpdate Method
https://msdn.microsoft.com/en-us/library/ee378665(v=vs.110).aspx