Advertisement
Guest User

watki

a guest
Oct 23rd, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using System.Threading;
  8. namespace ConsoleApplication4
  9. {
  10.     public class Program
  11.     {
  12.         public static object blokada = new object();
  13.         static void Main(string[] args)
  14.         {
  15.  
  16.             Thread t = new Thread(new ThreadStart(CosRobi));
  17.             Thread t1 = new Thread(new ThreadStart(ciag));
  18.             t1.Start();
  19.             t.Start();
  20.  
  21.  
  22.  
  23.  
  24.             Console.ReadKey();
  25.         }
  26.         static void ciag()
  27.         {
  28.             using (StreamWriter writer = new StreamWriter("important.txt"))
  29.             {
  30.                 writer.Write("Wątek pierwszy: słowo z małych liter");
  31.             }
  32.         }
  33.         static void CosRobi()
  34.         {
  35.             string line;
  36.             string line2;            
  37.                 using (StreamReader reader = new StreamReader("important.txt"))
  38.                 {
  39.                     line = reader.ReadLine();
  40.                     Console.WriteLine(line);
  41.                 }            
  42.                 line2 = line.ToUpper();
  43.  
  44.                     using (StreamWriter writer = new StreamWriter("important2.txt"))
  45.                     {
  46.                         writer.Write(line2);
  47.                     }            
  48.             Console.WriteLine("Wątek drugi - słowo powinno składać się z dużych liter: {0}", line2);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement