-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdelegates
More file actions
40 lines (33 loc) · 880 Bytes
/
delegates
File metadata and controls
40 lines (33 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
namespace mcaa
{
delegate void del(String s);
public class delegates
{
static void Helllo(String s)
{
System.Console.WriteLine("Hello {0}!", s);
}
static void Goodbye(String s)
{
System.Console.WriteLine("Goodby {0}!", s);
}
static void Main(string[] args)
{
delegates ab = new delegates();
del a, b, c, d;
a = Helllo;
b =Goodbye;
c = a + b;
d = c - a;
System.Console.WriteLine("invoking delegate a:");
a("A");
System.Console.WriteLine("invoking delegate b:");
b("B");
System.Console.WriteLine("invoking delegate c:");
c("C");
System.Console.WriteLine("invoking delegate d:");
d("D");
}
}
}