TheBulgarianWolf

Passing Data To A Thread(Lambda Expression)

Nov 20th, 2020
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace MoreMethodExercises
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.         //using lambda expression
  11.             Thread t = new Thread(() => Print("Hello from t!"));
  12.             t.Start();
  13.             Console.ReadLine();
  14.         }
  15.  
  16.         static void Print(string message)
  17.         {
  18.             Console.WriteLine(message);
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment