O'Reilly logo

C# 2008 and 2005 Threaded Programming: Beginner's Guide by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - Putting the logic into methods to simplify multithreading

Object-oriented code is one of the most valuable friends of multithreaded applications. We want the Encrypter class to be simple, self-contained, and efficient. Achieving this will help us in focusing on parallelizing the requests, and help in solving the threading problem.

Now, we are going to add some methods to the Encrypter class to complete the algorithm:

  1. Stay in the project, MarsEncrypter.
  2. Open the code for the Encrypter class.
  3. Add the following private method to load the text to encrypt into a string list from the specified input text file:
    private void LoadTextToEncrypt() { pasTextToEncrypt = new List<string>(); try { // Create an instance of StreamReader to read from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required