Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. void EnclosingMethod(bool outerVariable1, //1refint nonOuterVariable) //2
  2. {
  3. int outerVariable2 = 10; //3string capturedVariable = "captured"; //4if (outerVariable2 % 2 == 0)
  4. {
  5. int normalLocalVariable = 5; //5
  6. Console.WriteLine("Normal local variable: {0}", normalLocalVariable);
  7. }
  8.  
  9. WaitCallback d =
  10. delegate(object o)
  11. {
  12. int anonymousMethodLocalVariable = 12; //6
  13. Console.WriteLine("Captured variable is {0}", capturedVariable);
  14. };
  15.  
  16. ThreadPool.QueueUserWorkItem(d, null);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement