blob: cf9629ada382ef1431a507a8c44ab00adc4ecea9 (
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
37
38
39
40
41
42
43
44
|
//
// This test probes that we treat events differently than fields
// This used to cause a compiler crash.
//
using System;
delegate void PersonArrivedHandler (object source, PersonArrivedArgs args);
class PersonArrivedArgs /*: EventArgs*/ {
public string name;
public PersonArrivedArgs (string name) {
this.name = name;
}
}
class Greeter {
string greeting;
public Greeter (string greeting) {
this.greeting = greeting;
}
public void HandlePersonArrived (object source, PersonArrivedArgs args) {
Console.WriteLine(greeting, args.name);
}
}
class Room {
public event PersonArrivedHandler PersonArrived;
public Room () {}
public void AddPerson (string name) {
PersonArrived(this, null); //(this, PersonArrivedArgs(name));
}
}
class DelegateTest {
static int Main () {
return 0;
}
}
|