blob: 80b5393759abe4b086e0029b96ab33b65a0ee9d7 (
plain)
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
|
using System;
public delegate int DelType ();
struct S
{
public event DelType MyEvent;
public static event DelType MyEventStatic;
public int RunInstance ()
{
return MyEvent ();
}
public int RunStatic ()
{
return MyEventStatic ();
}
}
public class Test
{
public static int Main ()
{
S.MyEventStatic += delegate () { return 22; };
S s = new S ();
s.MyEvent += delegate () { return 6; };
if (s.RunInstance () != 6)
return 1;
if (s.RunStatic () != 22)
return 2;
return 0;
}
}
|