How to do it...

  1. Open Visual Studio 2017.
  2. Now, open the solution from the previous recipe. Click File | Open | Open Project/Solutionor press Ctrl + Shift + Oand select the Chapter6.Threads solution. 
  3. Press Ctrl + Shift + B for a quick build to check that everything is fine. 
  4. Click on the Chapter6.Threads solution label. Click File | Add | New Project.
  5. In the Add New Project template dialog box, expand the Visual C# node in the left-hand pane. 
  6. Select .NET Core and select Console App (.NET Core) in the right-hand pane:
  1. Now, in the Name: textbox, type Chapter6.Threads.ThreadsCore as the name of the project. The rest of the fields should be left as they are: 
  1. Click OK.
  2. Now, the Solution Explorer (press Ctrl + Alt + L) should display like this: 
  1. Right-click on the Dependencies label in the Chapter6.Threads.ThreadsCore.
  2. Select Add Reference.

 

  1. In the Reference Manager, click on the Projects label in the right-hand pane: 
  1. Check the Chapter6.Threads.ThreadLib project in the left-hand pane.
  2. Click OK.
  3. Now, double-click on the Program.cs label in the Solution Explorer.
  4. Scroll up in the code window and add the following using directive:
      using Chapter6.Threads.ThreadLib;
  1. Now, delete any existing code generated by Visual Studio in the Main() method and add the following code:
      var threads = new ThreadGenerator();
var output = threads.StartThreads();

Console.WriteLine(output);
Console.ReadLine();
  1. Press F5 to execute the app.
  1. You should see output like this:
  1. Press Enter to exit.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.219.65