Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace Delegates
  5. {
  6.     class Program
  7.     {
  8.         static void Main()
  9.         {
  10.             User u = new User();
  11.             u.Name = "Hello World";
  12.             u.SomeFunction(); //1
  13.  
  14.             SomeFunction(u); //2
  15.  
  16.         }
  17.  
  18.         static void SomeFunction(User user) //2
  19.         {
  20.             Console.WriteLine(user.Name);
  21.         }
  22.     }
  23.  
  24.  
  25.     class User
  26.     {
  27.         public string Name;
  28.  
  29.         public void SomeFunction() //1
  30.         {
  31.             Console.WriteLine(this.Name);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement