-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Multithreading with C# Cookbook, Second Edition - Second Edition
By :
This recipe shows you a very simple scenario, comparing the performance of a usual dictionary collection with the concurrent dictionary in a single-threaded environment.
To work through this recipe, you will need Visual Studio 2015. There are no other prerequisites. The source code for this recipe can be found at BookSamples\Chapter6\Recipe1.
To understand the difference between the performance of a usual dictionary collection and the concurrent dictionary, perform the following steps:
Start Visual Studio 2015. Create a new C# console application project.
In the Program.cs file, add the following using directives:
using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using static System.Console;
Add the following code snippet below the Main method:
const string Item = "Dictionary item"; const int Iterations = 1000000; public static string CurrentItem;
Add the following code snippet inside the Main method...
Change the font size
Change margin width
Change background colour